Public Member Functions | |
BlobStreamingService () | |
void | read (const coral::Blob &blobData, void *addressOfContainer, Reflex::Type const &classDictionary) |
Reads an object from a Blob and fills-in the container. | |
boost::shared_ptr< coral::Blob > | write (const void *addressOfInputData, Reflex::Type const &classDictionary, bool useCompression=true) |
virtual | ~BlobStreamingService () |
Private Types | |
typedef std::pair< unsigned long long, unsigned long long > | uuid |
enum | Variant { OLD, COMPRESSED_TBUFFER, COMPRESSED_CHARS } |
Static Private Member Functions | |
static boost::shared_ptr < coral::Blob > | compress (const void *addr, size_t isize) |
static boost::shared_ptr < coral::Blob > | expand (const coral::Blob &blobIn) |
static Variant | findVariant (const void *address) |
static int | isVectorChar (Reflex::Type const &classDictionary) |
Private Attributes | |
boost::shared_ptr < ora::IBlobStreamingService > | rootService |
Static Private Attributes | |
static const size_t | m_idsize = sizeof(uuid) |
static const size_t | m_offset = m_idsize + sizeof(unsigned long long) |
static const size_t | nVariants = 3 |
static uuid const | variantIds [nVariants] |
Definition at line 24 of file BlobStreamingService.cc.
typedef std::pair<unsigned long long, unsigned long long> cond::BlobStreamingService::uuid [private] |
Definition at line 39 of file BlobStreamingService.cc.
enum cond::BlobStreamingService::Variant [private] |
Definition at line 45 of file BlobStreamingService.cc.
cond::BlobStreamingService::BlobStreamingService | ( | ) |
Definition at line 62 of file BlobStreamingService.cc.
cond::BlobStreamingService::~BlobStreamingService | ( | ) | [virtual] |
Definition at line 64 of file BlobStreamingService.cc.
boost::shared_ptr< coral::Blob > cond::BlobStreamingService::compress | ( | const void * | addr, |
size_t | isize | ||
) | [static, private] |
Definition at line 184 of file BlobStreamingService.cc.
boost::shared_ptr< coral::Blob > cond::BlobStreamingService::expand | ( | const coral::Blob & | blobIn | ) | [static, private] |
Definition at line 202 of file BlobStreamingService.cc.
Referenced by read().
BlobStreamingService::Variant cond::BlobStreamingService::findVariant | ( | const void * | address | ) | [static, private] |
Definition at line 177 of file BlobStreamingService.cc.
: (Variant)(v-variantIds); }
int cond::BlobStreamingService::isVectorChar | ( | Reflex::Type const & | classDictionary | ) | [static, private] |
Definition at line 168 of file BlobStreamingService.cc.
Referenced by read().
void cond::BlobStreamingService::read | ( | const coral::Blob & | blobData, |
void * | addressOfContainer, | ||
Reflex::Type const & | classDictionary | ||
) | [virtual] |
Reads an object from a Blob and fills-in the container.
Implements ora::IBlobStreamingService.
Definition at line 112 of file BlobStreamingService.cc.
References COMPRESSED_CHARS, COMPRESSED_TBUFFER, expand(), isVectorChar(), OLD, and rootService.
: findVariant(blobData.startingAddress()); switch (v) { case OLD : { rootService->read( blobData, addressOfContainer, classDictionary); } break; case COMPRESSED_TBUFFER : { boost::shared_ptr<coral::Blob> blobIn = expand(blobData); rootService->read( *blobIn, addressOfContainer, classDictionary); } break; case COMPRESSED_CHARS : { boost::shared_ptr<coral::Blob> blobIn = expand(blobData); int const k = isVectorChar(classDictionary); switch (k) { case 0 : { // error!!! } break; case 1: { std::vector<unsigned char> & v = *reinterpret_cast< std::vector<unsigned char> *> (addressOfContainer); // we should avoid the copy! v.resize(blobIn->size()); std::memcpy(&v.front(),blobIn->startingAddress(),v.size()); } break; case 2: { std::vector<char> & v = *reinterpret_cast< std::vector<char> *> (addressOfContainer); // we should avoid the copy! v.resize(blobIn->size()); std::memcpy(&v.front(),blobIn->startingAddress(),v.size()); } break; } } } }
boost::shared_ptr< coral::Blob > cond::BlobStreamingService::write | ( | const void * | addressOfInputData, |
Reflex::Type const & | classDictionary, | ||
bool | useCompression = true |
||
) | [virtual] |
Implements ora::IBlobStreamingService.
Definition at line 66 of file BlobStreamingService.cc.
{ case 0 : { // at the moment we write TBuffer compressed, than we see.... // we may wish to avoid one buffer copy... boost::shared_ptr<coral::Blob> buffer = rootService->write(addressOfInputData, classDictionary); if( useCompression ){ blobOut = compress(buffer->startingAddress(),buffer->size()); *reinterpret_cast<uuid*>(blobOut->startingAddress()) = variantIds[COMPRESSED_TBUFFER]; } else { blobOut = buffer; } } break; case 1 : { if( useCompression ){ std::vector<unsigned char> const & v = *reinterpret_cast< std::vector<unsigned char> const *> (addressOfInputData); blobOut = compress(&v.front(),v.size()); *reinterpret_cast<uuid*>(blobOut->startingAddress()) = variantIds[COMPRESSED_CHARS]; } else { blobOut = rootService->write(addressOfInputData,classDictionary); } } break; case 2 : { if( useCompression ){ std::vector<char> const & v = *reinterpret_cast<std::vector<char> const *> (addressOfInputData); blobOut = compress(&v.front(),v.size()); *reinterpret_cast<uuid*>(blobOut->startingAddress()) = variantIds[COMPRESSED_CHARS]; } else { blobOut = rootService->write(addressOfInputData,classDictionary); } } break; } return blobOut; }
const size_t cond::BlobStreamingService::m_idsize = sizeof(uuid) [static, private] |
Definition at line 41 of file BlobStreamingService.cc.
const size_t cond::BlobStreamingService::m_offset = m_idsize + sizeof(unsigned long long) [static, private] |
Definition at line 42 of file BlobStreamingService.cc.
const size_t cond::BlobStreamingService::nVariants = 3 [static, private] |
Definition at line 43 of file BlobStreamingService.cc.
boost::shared_ptr<ora::IBlobStreamingService> cond::BlobStreamingService::rootService [private] |
Definition at line 57 of file BlobStreamingService.cc.
Referenced by read().
const BlobStreamingService::uuid cond::BlobStreamingService::variantIds [static, private] |
{ BlobStreamingService::uuid(0,0) ,BlobStreamingService::uuid(0xf4e92f169c974e8eLL, 0x97851f372586010dLL) ,BlobStreamingService::uuid(0xc9a95a45e60243cfLL, 0x8dc549534f9a9274LL) }
Definition at line 46 of file BlobStreamingService.cc.