7#ifdef USE_BOOST_ARCHIVE
8#include <boost/archive/basic_archive.hpp>
11namespace serialization {
38template<
class Archive>
39void Object::serialize(Archive &ar)
41 d()->serialize<Archive>(ar);
44template<
class Archive>
53 ar &
V_NAME(ar,
"attributes", attrMap);
56template<
class Archive>
62 ar &
V_NAME(ar,
"attributes", attrMap);
63 for (
auto &kv: attrMap) {
65 auto &vallist = kv.second;
70template<
class Archive>
75 this->saveToArchive(ar);
78template<
class Archive>
84 ar &
V_NAME(ar,
"object_name", arname);
85 std::string name = ar.translateObjectName(arname);
87 ar &
V_NAME(ar,
"object_type", type);
96 if (!ar.currentObject())
97 ar.setCurrentObject(objData);
102 std::cerr <<
"Object::loadObject: have " << name <<
", but incomplete, refcount=" << objData->
refcount()
111 ar.registerObjectNameTranslation(arname, name);
112 obj->loadFromArchive(ar);
115#ifdef USE_BOOST_ARCHIVE
116 }
catch (
const boost::archive::archive_exception &ex) {
117 std::cerr <<
"Boost.Archive exception: " << ex.what() << std::endl;
118 if (ex.code == boost::archive::archive_exception::unsupported_version) {
119 std::cerr <<
"***" << std::endl;
120 std::cerr <<
"*** received Boost archive in unsupported format, supported is up to "
121 << boost::archive::BOOST_ARCHIVE_VERSION() << std::endl;
122 std::cerr <<
"***" << std::endl;
126 }
catch (std::exception &ex) {
127 std::cerr <<
"exception during object loading: " << ex.what() << std::endl;
132 assert(ar.currentObject() == obj->
d());
136 if (ar.objectCompletionHandler())
137 ar.objectCompletionHandler()();
#define V_NAME(ar, name, obj)
Definition: archives_config.h:441
static const struct FunctionTable & getType(int id)
Definition: object.cpp:733
int refcount() const
Definition: object.cpp:344
Data * d() const
Definition: object.h:211
static Object * createEmpty(const std::string &name=std::string())
Definition: object.cpp:290
static Object * loadObject(Archive &ar)
Definition: object_impl.h:79
virtual void refresh() const
refresh cached pointers from shm
Definition: object.cpp:301
void saveObject(Archive &ar) const
Definition: object_impl.h:71
Type getType() const
Definition: object.cpp:380
static Object * create(Data *)
Definition: object.cpp:132
virtual bool check() const
Definition: object.cpp:304
std::string getName() const
Definition: object.cpp:385
ObjectData * getObjectDataFromName(const std::string &name) const
Definition: shm.cpp:581
void unlockObjects() const
Definition: shm.cpp:203
static Shm & the()
Definition: shm.cpp:315
void lockObjects() const
Definition: shm.cpp:191
#define V_COREEXPORT
Definition: export.h:9
Definition: serialize.h:35
Definition: allobjects.cpp:30
std::map< std::string, std::vector< std::string > > StdAttributeMap
Definition: object.h:251
std::atomic< int > unresolvedReferences
no. of not-yet-available arrays and referenced objects
Definition: object.h:236
std::pair< const Key, AttributeList > AttributeMapValueType
Definition: object.h:243
ARCHIVE_ACCESS_SPLIT void save(Archive &ar) const
V_COREEXPORT bool isComplete() const
Definition: object.cpp:204
V_COREEXPORT std::vector< std::string > getAttributeList() const
Definition: object.cpp:620
Meta meta
Definition: object.h:238
void load(Archive &ar)
Definition: object_impl.h:57
V_COREEXPORT std::vector< std::string > getAttributes(const std::string &key) const
Definition: object.cpp:605
AttributeMap attributes
Definition: object.h:250
V_COREEXPORT int unref() const
Definition: object.cpp:364
V_COREEXPORT void setAttributeList(const std::string &key, const std::vector< std::string > &values)
Definition: object.cpp:551
V_COREEXPORT int ref() const
Definition: object.cpp:359
shm< Attribute >::vector AttributeList
Definition: object.h:242
int refcount() const
Definition: shmdata.h:35
boost::interprocess::basic_string< T, std::char_traits< T >, allocator > string
Definition: shm.h:112