Class Streamable
Defined in File streamable.h
Inheritance Relationships
Derived Types
public cpphots::interfaces::Clusterer(Class Clusterer)public cpphots::interfaces::EventRemapper(Struct EventRemapper)public cpphots::interfaces::SuperCell(Class SuperCell)public cpphots::interfaces::TimeSurfaceCalculator(Class TimeSurfaceCalculator)public cpphots::interfaces::TimeSurfacePoolCalculator(Class TimeSurfacePoolCalculator)public cpphots::Network(Class Network)
Class Documentation
-
class cpphots::interfaces::Streamable
Class that can be inserted to/read from a stream.
This interface should be implemented by all components which support saving/loading from file.
This class also provided static functions to handle metacommands, that are string prefixed by ‘!’ which are used to load components for layers and networks.
Subclassed by cpphots::interfaces::Clusterer, cpphots::interfaces::EventRemapper, cpphots::interfaces::SuperCell, cpphots::interfaces::TimeSurfaceCalculator, cpphots::interfaces::TimeSurfacePoolCalculator, cpphots::Network
Public Functions
-
virtual void toStream(std::ostream &out) const = 0
Insert to stream.
- Parameters
out – stream where to insert to
-
virtual void fromStream(std::istream &in) = 0
Extract from stream.
Parameters/current state is expected to be overwritten or invalidated.
- Parameters
in – stream where to extract from
Public Static Functions
-
static std::string getNextMetacommand(std::istream &in)
Get the next metacommand in the stream.
- Parameters
in – input stream
- Returns
metacommand, might be empty
Protected Static Functions
-
static void writeMetacommand(std::ostream &out, const std::string &cmd)
Write a metacommand.
This function will write the command prepending a ‘!’ and adjusting the case.
- Parameters
out – stream
cmd – metacommand (without !)
-
static void matchMetacommandOptional(std::istream &in, const std::string &cmd)
Match an optional metacommand.
Try to match a metacommand. The function will succeed if the metacommand is found or if there are no metacommands at the beginning of the stream.
An exception will be thrown in case an unexpected metacommand is encountered.
- Parameters
in – stream
cmd – metacommand (without !)
-
static void matchMetacommandRequired(std::istream &in, const std::string &cmd)
Match a metacommand.
Try to match a metacommand. The function will succeed if the metacommand is found.
An exception will be thrown in case an unexpected metacommand is encountered or if there are no metacommands at the beginning of the stream.
- Parameters
in – stream
cmd – metacommand (without !)
-
virtual void toStream(std::ostream &out) const = 0