X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FFileHandle.cci;h=4ace14c3be2921d9fda8659b5a3b7fc8cd6e1fb2;hb=51044eb18f034c1a059ffe2fb109a422c1cbe251;hp=37c269d6f9c9416aa1b32bcd4b612005398f31c2;hpb=8421c3a8da7485cb8781045494ecaab3ed84f403;p=senf.git diff --git a/Socket/FileHandle.cci b/Socket/FileHandle.cci index 37c269d..4ace14c 100644 --- a/Socket/FileHandle.cci +++ b/Socket/FileHandle.cci @@ -1,9 +1,9 @@ // $Id$ // // Copyright (C) 2006 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) -// Stefan Bund +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Stefan Bund // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,8 +27,9 @@ //#include "FileHandle.ih" // Custom includes +#include "../Utils/senfassert.hh" #include -#include "Utils/Exception.hh" +#include "../Utils/Exception.hh" #define prefix_ inline ///////////////////////////////cci.p/////////////////////////////////////// @@ -54,7 +55,7 @@ prefix_ senf::FileBody::~FileBody() prefix_ void senf::FileBody::close() { if (!valid()) - throw SystemException(EBADF); + throwErrno(EBADF); v_close(); fd_ = -1; } @@ -67,6 +68,11 @@ prefix_ void senf::FileBody::terminate() } } +prefix_ senf::FileHandle senf::FileBody::handle() +{ + return FileHandle(ptr(this)); +} + prefix_ int senf::FileBody::fd() const { @@ -194,16 +200,20 @@ prefix_ senf::FileHandle::FileHandle(std::auto_ptr body) : body_(body.release()) {} +prefix_ senf::FileHandle::FileHandle(FileBody::ptr body) + : body_(body) +{} + prefix_ senf::FileBody & senf::FileHandle::body() { - BOOST_ASSERT(body_); + SENF_ASSERT(body_); return *body_; } prefix_ senf::FileBody const & senf::FileHandle::body() const { - BOOST_ASSERT(body_); + SENF_ASSERT(body_); return *body_; } @@ -250,4 +260,6 @@ prefix_ int senf::retrieve_filehandle(FileHandle handle) // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 // End: