25 #include <ibrcommon/thread/MutexLock.h>
41 static ibrcommon::Mutex mutex;
42 ibrcommon::MutexLock l(mutex);
52 std::map<block_t, ExtensionBlock::Factory*>::iterator iter = fmap.find(type);
54 if (iter != fmap.end())
56 return *(iter->second);
59 throw ibrcommon::Exception(
"Factory not available");
66 throw ibrcommon::Exception(
"extension block type already taken");
67 }
catch (
const ibrcommon::Exception&) {
96 :
Block(0), _blobref(ibrcommon::BLOB::create())
101 :
Block(0), _blobref(ref)
121 return _blobref.size();
126 ibrcommon::BLOB::Reference blobref = _blobref;
127 ibrcommon::BLOB::iostream io = blobref.iostream();
130 ibrcommon::BLOB::copy(stream, *io, io.size());
131 }
catch (
const ibrcommon::IOException &ex) {
141 ibrcommon::BLOB::iostream io = _blobref.iostream();
150 ibrcommon::BLOB::copy(*io, stream, length);
151 }
catch (
const ibrcommon::IOException &ex) {
static FactoryList * factories
void setType(block_t type)
virtual std::ostream & serialize(std::ostream &stream, Length &length) const
Factory & get(block_t type)
void set(ProcFlags flag, const bool &value)
virtual Length getLength() const
static Factory & get(block_t type)
ibrcommon::BLOB::Reference getBLOB() const
virtual ~ExtensionBlock()
void remove(block_t type)
void add(block_t type, Factory *f)
virtual std::istream & deserialize(std::istream &stream, const Length &length)