 |
AGX Dynamics
2.38.0.2
|
Go to the documentation of this file.
41 agx::UInt16 const serializationVersionAtChange = 71;
45 return agxStream::detail::shouldReadDataFromArchive(
47 archiveSerializationVersion,
48 serializationVersionInRc,
49 serializationVersionAtChange,
51 agxVersionInTrunkAfterRc);
71 return agxStream::detail::shouldReadDataFromArchive(
73 archiveSerializationVersion,
74 serializationVersionInRc,
75 serializationVersionAtChange,
77 agxVersionInTrunkAfterRc);
100 template<
typename Component>
103 return !c->getIgnoreForStoreRestoreStream();
107 template<
typename Container>
110 using Component =
typename Container::value_type;
112 size_t count = count_if(
begin(components),
end(components), shouldStore<Component>);
118 template<
typename Container>
126 template<
typename Container>
137 bool match = numStored == numRestorable;
141 LOGGER_WARNING() <<
" Stream contains " << numStored <<
" and power line contains " << numRestorable <<
" restorable connectors." <<
LOGGER_ENDL();
195 bool match = endMarker == marker;
258 const char*
const parentName,
259 const char*
const dataName)
262 const bool parentHasObject =
object !=
nullptr;
263 bool streamHasObject;
264 stream >> streamHasObject;
267 bool const bothHaveObject = parentHasObject && streamHasObject;
268 bool const neitherHasObject = !parentHasObject && !streamHasObject;
269 bool const onlyParentHasObject = parentHasObject && !streamHasObject;
270 bool const onlyStreamHasObject = !parentHasObject && streamHasObject;
274 (
object->*restore)(stream);
277 else if (neitherHasObject)
282 else if (onlyParentHasObject)
287 else if (onlyStreamHasObject)
289 LOGGER_WARNING() << parentName <<
" expected " << dataName <<
" data in StoageStream, but there were none." <<
LOGGER_ENDL();
294 agxAbort1(
"Logic error. All possible cases should have been handled already.");
307 bool hasConstraint =
object !=
nullptr;
308 out << hasConstraint;
310 object->storeLightData(
out);
334 const char *
const parentName,
335 const char *
const dataName)
370 const char*
const parentName,
371 const char*
const dataName)
373 const bool parentHasObject =
object !=
nullptr;
374 bool streamHasObject;
375 stream >> streamHasObject;
377 bool const bothHaveObject = parentHasObject && streamHasObject;
378 bool const neitherHasObject = !parentHasObject && !streamHasObject;
379 bool const onlyParentHasObject = parentHasObject && !streamHasObject;
380 bool const onlyStreamHasObject = !parentHasObject && streamHasObject;
384 return object->restore(stream);
386 else if (neitherHasObject)
391 else if (onlyParentHasObject)
396 else if (onlyStreamHasObject)
398 LOGGER_WARNING() << parentName <<
" expected " << dataName <<
" data in StoageStream, but there were none." <<
LOGGER_ENDL();
403 agxAbort1(
"Logic error. All possible cases should have been handled already.");
bool optionallyRestore(agxStream::StorageStream &stream, T *object, const char *const parentName, const char *const dataName)
Restores data for the given object if the object is not nullptr and the stream contains data for it.
bool restorePowerLineBeginMarker(agxStream::StorageStream &in)
const agx::UInt16 LIGHT_DATA_END_MARKER
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
void storeUnitEndMarker(agxStream::StorageStream &out)
void storeLightDataBeginMarker(agxStream::StorageStream &out)
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive.
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
const agx::UInt16 POWERLINE_BEGIN_MARKER
bool restoreRestorablesCount(const Container &components, agxStream::StorageStream &in)
const agx::UInt16 UNIT_END_MARKER
#define AGXSTREAM_SERIALIZATION_VERSION_POWER_LINE_ROTAT_LOCAL_OR_WORLD_DIRECTION
const agx::UInt16 MARKER_SERIALIZATION_VERSION
bool restoreLightDataEndMarker(agxStream::StorageStream &in)
void storeLightDataEndMarker(agxStream::StorageStream &out)
bool restoreUnitEndMarker(agxStream::StorageStream &in)
Abstract base class for storing/restoring a line/drums with version control.
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
const agx::UInt16 POWERLINE_END_MARKER
AGXCORE_EXPORT agx::UInt32 AGX_CALC_VERSION(agx::UInt8 generation, agx::UInt8 major, agx::UInt8 minor, agx::UInt8 patch)
void(agxStream::Serializable::* RestoreMemFn)(agxStream::StorageStream &)
Member function signature for methods that read data from a StorageStream.
bool hasMarkers(agxStream::StorageStream &in)
size_t countStoreRestorable(const Container &components)
void storeStorablesCount(const Container &components, agxStream::StorageStream &out)
bool optionallyRestoreLightData(agxStream::StorageStream &in, agxStream::Serializable *object, const char *const parentName, const char *const dataName)
Restores light data for the given object if the object is not nullptr and the stream contains data fo...
bool restoreConnectorEndMarker(agxStream::StorageStream &in)
agxPowerLine contains a collection of connected components that transport power across a system.
bool restoreLightDataBeginMarker(agxStream::StorageStream &in)
void optionallyStoreLightData(agxStream::StorageStream &out, agxStream::Serializable *object)
bool optionallyRestore_helper(agxStream::StorageStream &stream, agxStream::Serializable *object, RestoreMemFn restore, const char *const parentName, const char *const dataName)
Main worker helper for optinally restore.
bool restoreMarker(agxStream::StorageStream &in, agx::UInt16 marker, const char *name)
bool restorePowerLineEndMarker(agxStream::StorageStream &in)
bool shouldStore(const Component &c)
const agx::UInt16 LIGHT_DATA_BEGIN_MARKER
const agx::UInt16 CONNECTOR_END_MARKER
void storeConnectorEndMarker(agxStream::StorageStream &out)
void storePowerLineBeginMarker(agxStream::StorageStream &out)
bool shouldReadRotationalDimensionDirectionReference(size_t archiveAgxVersion, agx::UInt16 archiveSerializationVersion)
bool shouldReadRotationalActuatorConnectorData(size_t archiveAgxVersion, agx::UInt16 archiveSerializationVersion)
void storePowerLineEndMarker(agxStream::StorageStream &out)