Caffa  0.12.1
C++ Application Framework for Embedded Systems with introspection
Public Member Functions | Public Attributes | List of all members
caffa::Object Class Reference
Inheritance diagram for caffa::Object:
Inheritance graph
[legend]
Collaboration diagram for caffa::Object:
Collaboration graph
[legend]

Public Member Functions

std::string classKeywordDynamic () const override
 Get the class keyword through polymorphism. More...
 
template<typename FieldType >
FieldInitHelper< FieldType > initField (FieldType &field, const std::string &keyword)
 
std::string uuid () const override
 
void setUuid (const std::string &uuid) override
 
- Public Member Functions inherited from caffa::ObjectHandle
std::vector< FieldHandle * > fields () const
 
FieldHandlefindField (const std::string &keyword) const
 
FieldHandleparentField () const
 
std::list< ObjectHandle * > matchingDescendants (Predicate predicate) const
 
std::list< ObjectHandle * > children () const
 
void prepareForDelete () noexcept
 
void addCapability (ObjectCapability *capability, bool takeOwnership)
 
template<typename CapabilityType >
CapabilityType * capability () const
 
- Public Member Functions inherited from caffa::SignalObserver
std::list< AbstractSignal * > observedSignals () const
 
void addObservedSignal (AbstractSignal *signalToAdd) const
 
void removeObservedSignal (AbstractSignal *signalToRemove) const noexcept
 
- Public Member Functions inherited from caffa::SignalEmitter
void addEmittedSignal (AbstractSignal *signalToAdd) const
 
std::list< AbstractSignal * > emittedSignals () const
 
- Public Member Functions inherited from caffa::ObjectIoCapability
 ObjectIoCapability (ObjectHandle *owner, bool giveOwnership)
 
virtual std::string classKeyword () const =0
 The classKeyword method is overridden in subclasses by the CAFFA_HEADER_INIT macro.
 
virtual bool matchesClassKeyword (const std::string &classKeyword) const =0
 
virtual std::vector< std::string > classInheritanceStack () const =0
 
void initAfterReadRecursively ()
 
void setupBeforeSaveRecursively ()
 
std::unique_ptr< ObjectHandlecopyBySerialization (ObjectFactory *objectFactory) const
 
std::unique_ptr< ObjectHandlecopyAndCastBySerialization (const std::string &destinationClassKeyword, ObjectFactory *objectFactory) const
 
template<typename ObjectType >
std::unique_ptr< ObjectType > copyTypedObjectBySerialization (ObjectFactory *objectFactory) const
 Copy the object by serializing it and then casting it to the given type. Note that the object will be deleted if the cast fails. More...
 
bool readFile (const std::string &fileName, IoType ioType=IoType::JSON)
 
bool writeFile (const std::string &fileName, IoType ioType=IoType::JSON)
 
bool readStream (std::istream &inStream, IoType ioType=IoType::JSON)
 
bool writeStream (std::ostream &outStream, IoType ioType=IoType::JSON)
 
bool readStream (std::istream &inStream, const Serializer &serializer)
 
bool writeStream (std::ostream &outStream, const Serializer &serializer)
 

Public Attributes

 CAFFA_HEADER_INIT
 

Additional Inherited Members

- Public Types inherited from caffa::ObjectHandle
using Predicate = std::function< bool(const ObjectHandle *)>
 
- Public Types inherited from caffa::ObjectIoCapability
enum  IoType { JSON }
 
- Static Public Member Functions inherited from caffa::ObjectHandle
static std::string classKeywordStatic ()
 
static std::vector< std::string > classInheritanceStackStatic ()
 
- Static Public Member Functions inherited from caffa::ObjectIoCapability
static bool isValidElementName (const std::string &name)
 Check if a string is a valid element name. More...
 
- Protected Member Functions inherited from caffa::ObjectHandle
void addField (FieldHandle *field, const std::string &keyword)
 
- Protected Member Functions inherited from caffa::ObjectIoCapability
virtual void initAfterRead ()
 
virtual void setupBeforeSave ()
 
bool isInheritedFromSerializable () const
 
- Protected Attributes inherited from caffa::ObjectIoCapability
ObjectHandlem_owner
 

Member Function Documentation

◆ classKeywordDynamic()

std::string Object::classKeywordDynamic ( ) const
overridevirtual

Get the class keyword through polymorphism.

Returns
a class keyword string

Implements caffa::ObjectHandle.

◆ initField()

template<typename FieldType >
FieldInitHelper<FieldType> caffa::Object::initField ( FieldType &  field,
const std::string &  keyword 
)
inline

Initialises the field with a file keyword and registers it with the class including static user interface related information. Note that classKeyword() is not virtual in the constructor of the Object This is expected and fine.

Parameters
fieldA reference to the field
keywordThe field keyword. Has to be unique within the class.

The documentation for this class was generated from the following files: