#include <archive.hpp>
Inheritance diagram for MynahSA::Archive:
Public Member Functions | |
Archive () | |
constructor | |
Archive (const Archive &ar) | |
copy constructor - copy constructor functions | |
Archive (const std::map< std::string, SHARED_PTR< Archive::ArchiveConstructor > > &cons) | |
construct with a pre-existing map of constructor functions | |
virtual | ~Archive () |
virtual destructor | |
void | registerConstructor (const std::string &name, const SHARED_PTR< ArchiveConstructor > &cons) |
const std::map< std::string, SHARED_PTR< ArchiveConstructor > > & | getConstructors () const |
provide external access to constructor functions | |
virtual Archive & | operator & (long long &)=0 |
archive long long | |
virtual Archive & | operator & (unsigned long long &)=0 |
archive unsigned long long | |
virtual Archive & | operator & (unsigned int &)=0 |
archive unsigned int | |
virtual Archive & | operator & (int &)=0 |
archive int | |
virtual Archive & | operator & (short &)=0 |
archive short | |
virtual Archive & | operator & (unsigned short &)=0 |
archvie ushort | |
virtual Archive & | operator & (char &)=0 |
archive char | |
virtual Archive & | operator & (unsigned char &)=0 |
archive unsigned char | |
virtual Archive & | operator & (bool &)=0 |
archive bool | |
virtual Archive & | operator & (float &)=0 |
archive float | |
virtual Archive & | operator & (double &)=0 |
archive double | |
virtual Archive & | operator & (std::string &)=0 |
archive std::string | |
template<class T> | |
Archive & | operator & (std::vector< T > &v) |
archive a std::vector | |
template<class T> | |
Archive & | operator & (std::list< T > &l) |
archive a std::list | |
template<class a_type, class b_type> | |
Archive & | operator & (std::pair< a_type, b_type > &p) |
Archive a std::pair. | |
template<class value_type> | |
Archive & | operator & (std::set< value_type > &s) |
archive a std::map - store indicies and data | |
template<class index_type, class value_type> | |
Archive & | operator & (std::map< index_type, value_type > &m) |
archive a std::map - store indicies and data | |
template<class index_type, class value_type> | |
Archive & | operator & (std::multimap< index_type, value_type > &m) |
archive a std::map - store indicies and data | |
template<class T> | |
Archive & | operator & (SHARED_PTR< T > &ptr) |
template<class T> | |
Archive & | operator & (T &x) |
void | clearUPR () |
template<class T> | |
void | touchPtr (const SHARED_PTR< T > &ptr) |
Protected Types | |
enum | ArchiveMode |
Protected Member Functions | |
virtual ArchiveMode | getArchiveMode () const =0 |
Classes | |
class | ArchiveConstructor |
Definition at line 43 of file archive.hpp.
|
clearUPR - remove all unique pointer references from the archive, and free any associated memory by removing dangling SHARED_PTRs. This method servers an important purpose: When objects are serialized by SHARED_PTR, Archive holds a copy of the shared pointer. This is necessary s.t. multiple pointers to the same object do not cause multiple object to be transmitted. clearUPR must be called to free all such references. To make this explicit, here are two code sequences with explaination of what is being transmitted: Archive& archive; // some non-pure derivitive of MynahSA::Archive SHARED_PTR<ObjectType> sp1; // a shared pointer to a real instance archive << sp1; // transmit sp1 archive << sp1; // transmit sp1This sequence causes the following information to be transmitted on the stream: [shared_pointer to ObjectType [(*sp1) details]] [unique pointer reference to sp1] whereas, this code sequence: Archive& archive; // some non-pure derivitive of MynahSA::Archive SHARED_PTR<ObjectType> sp1; // a shared pointer to a real instance archive << sp1; // transmit sp1 archive.clearUPR(); // remove all unique pointer references archive << sp1; // transmit sp1caues the following to be emitted on the stream: [shared_pointer to ObjectType [(*sp1) details]] [shared_pointer to ObjectType [(*sp1) details]] Reimplemented in MynahSA::SSLArchiveStream, and MynahSA::TCPArchiveStream. |
|
return the archive mode - reader or writer. This is necessary for archiving certain STL types Implemented in MynahSA::IArchive< T >, MynahSA::OArchive< T >, MynahSA::IArchive< ISSLStream >, MynahSA::IArchive< ITCPStream >, MynahSA::OArchive< OTCPStream >, and MynahSA::OArchive< OSSLStream >. Referenced by operator &(). |
|
A template class handler - objects must be either enum type (as identified by is_enum , or provide a serialize method
ar & arrayType; // where ar is an archive instance
on SUNpro 5.8 the compiler cannot differentiate the use of operator& and the "address of" operator. Therefore, the following code fragment must be used: ar.operator&(arrayType); Definition at line 344 of file archive.hpp. 00344 { 00345 // a bit of template meta-programming, 00346 serializeArray(x, MynahSA::array_t<T>()); 00347 return *this; 00348 }
|
|
Archive operator& for shared pointer types. Note that this code path is forked depending on whether or not the type being serialized is a fundamental type (fundamental_t) e.g. int, char, etc... or a complex type. Complex types must derive from class IoBase; Definition at line 322 of file archive.hpp.
|
|
register a constructor object with this iarchive instance - this is necessary for restoration of objects pointed to by shared pointers. Note: Ownership of the IArchiveConstructor is taken by this class. Reimplemented in MynahSA::SSLArchiveStream, and MynahSA::TCPArchiveStream. Definition at line 83 of file archive.hpp.
|
|
touch a pointer - this indicates to the archiver that it should place a real pointer onto the stream and not a pointer reference. Definition at line 387 of file archive.hpp. 00387 { 00388 SHARED_PTR<void> value(STATIC_PTR_CAST<void>(ptr)); // fetch pointer value 00389 std::map<SHARED_PTR<void>, unsigned int>::iterator mit = _ptrToUPR.find(value); // find its universal pointer value 00390 if (mit != _ptrToUPR.end()) { 00391 unsigned int upr = (*mit).second; 00392 _ptrToUPR.erase(mit); // get rid of the upr and pointer associated 00393 std::map<unsigned int, SHARED_PTR<void> >::iterator mit2 = _uprToPtr.find(upr); 00394 if (mit2 != _uprToPtr.end()) { 00395 _uprToPtr.erase(mit2); 00396 } 00397 } 00398 }
|