MADARA  3.1.8
madara::knowledge::containers::BaseContainer Class Referenceabstract

This class is an abstract base class for all containers. More...

#include <BaseContainer.h>

Inheritance diagram for madara::knowledge::containers::BaseContainer:
Collaboration diagram for madara::knowledge::containers::BaseContainer:

Public Member Functions

 BaseContainer (const std::string &name="", const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings())
 Constructor. More...
 
 BaseContainer (const BaseContainer &rhs)
 Copy constructor. More...
 
virtual ~BaseContainer ()
 Destructor. More...
 
virtual BaseContainerclone (void) const =0
 Clones this container. More...
 
std::string get_name (void) const
 Returns the name of the container. More...
 
KnowledgeUpdateSettings get_settings (void)
 Gets the update settings for the container. More...
 
virtual bool modify_if_false (BaseContainer &conditional)
 Modifies the container if the argument is false. More...
 
virtual bool modify_if_true (BaseContainer &conditional)
 Modifies the container if the argument is true. More...
 
void set_settings (const KnowledgeUpdateSettings &settings)
 Sets the update settings for the container. More...
 

Protected Member Functions

virtual std::string get_debug_info_ (void)=0
 Returns the type of the container along with name and any other useful information. More...
 
virtual bool is_false_ (void) const =0
 Polymorphic is false method which can be used to determine if all values in a container are false. More...
 
virtual bool is_true_ (void) const =0
 Polymorphic is true method which can be used to determine if all values in a container are true. More...
 
virtual void modify_ (void)=0
 Polymorphic modify method used by collection containers. More...
 

Protected Attributes

ThreadSafeContextcontext_
 Variable context that we are modifying. More...
 
MADARA_LOCK_TYPE mutex_
 guard for access and changes More...
 
std::string name_
 Prefix of variable. More...
 
KnowledgeUpdateSettings settings_
 Settings for modifications. More...
 

Friends

class Collection
 Allow Collection class to access protected/private areas. More...
 

Detailed Description

This class is an abstract base class for all containers.

Definition at line 33 of file BaseContainer.h.

Constructor & Destructor Documentation

madara::knowledge::containers::BaseContainer::BaseContainer ( const std::string &  name = "",
const KnowledgeUpdateSettings settings = KnowledgeUpdateSettings () 
)

Constructor.

Parameters
nameprefix of the variable in the knowledge base
settingssettings for updating knowledge

Definition at line 6 of file BaseContainer.cpp.

madara::knowledge::containers::BaseContainer::BaseContainer ( const BaseContainer rhs)

Copy constructor.

Parameters
rhsthe source object to copy

Definition at line 13 of file BaseContainer.cpp.

madara::knowledge::containers::BaseContainer::~BaseContainer ( )
virtual

Destructor.

Definition at line 22 of file BaseContainer.cpp.

Member Function Documentation

virtual std::string madara::knowledge::containers::BaseContainer::get_debug_info_ ( void  )
protectedpure virtual

Returns the type of the container along with name and any other useful information.

The provided information should be useful for developers wishing to debug container operations, especially as it pertains to pending network operations (i.e., when used in conjunction with modify)

Returns
info in format {container}: {name}{ = value, if appropriate}

Implemented in madara::knowledge::containers::FlexMap, madara::knowledge::containers::Vector, madara::knowledge::containers::Map, madara::knowledge::containers::BufferVector, madara::knowledge::containers::DoubleStaged, madara::knowledge::containers::IntegerStaged, madara::knowledge::containers::IntegerVector, madara::knowledge::containers::DoubleVectorVector, madara::knowledge::containers::IntegerVectorVector, madara::knowledge::containers::StringVector, madara::knowledge::containers::DoubleVector, madara::knowledge::containers::StringStaged, madara::knowledge::containers::Counter, madara::knowledge::containers::Double, madara::knowledge::containers::Integer, madara::knowledge::containers::DoubleVector3D, madara::knowledge::containers::IntegerVector3D, madara::knowledge::containers::String, madara::knowledge::containers::IntegerVector2D, madara::knowledge::containers::DoubleVector2D, madara::knowledge::containers::Barrier, madara::knowledge::containers::NativeDoubleVector, madara::knowledge::containers::NativeDoubleVectorStaged, madara::knowledge::containers::NativeIntegerVector, madara::knowledge::containers::NativeIntegerVectorStaged, and madara::knowledge::containers::Collection.

std::string madara::knowledge::containers::BaseContainer::get_name ( void  ) const
inline

Returns the name of the container.

Returns
name of the container

Definition at line 5 of file BaseContainer.inl.

madara::knowledge::KnowledgeUpdateSettings madara::knowledge::containers::BaseContainer::get_settings ( void  )

Gets the update settings for the container.

Returns
the current settings

Definition at line 37 of file BaseContainer.cpp.

virtual void madara::knowledge::containers::BaseContainer::modify_ ( void  )
protectedpure virtual

Polymorphic modify method used by collection containers.

This method calls the modify method for this class. We separate the faster version (modify) from this version (modify_) to allow users the opportunity to have a fastery version that does not use polymorphic functions (generally virtual functions are half as efficient as normal function calls)

Implemented in madara::knowledge::containers::FlexMap, madara::knowledge::containers::Vector, madara::knowledge::containers::Map, madara::knowledge::containers::BufferVector, madara::knowledge::containers::DoubleStaged, madara::knowledge::containers::IntegerStaged, madara::knowledge::containers::IntegerVector, madara::knowledge::containers::DoubleVectorVector, madara::knowledge::containers::IntegerVectorVector, madara::knowledge::containers::StringVector, madara::knowledge::containers::DoubleVector, madara::knowledge::containers::StringStaged, madara::knowledge::containers::Counter, madara::knowledge::containers::Double, madara::knowledge::containers::Integer, madara::knowledge::containers::DoubleVector3D, madara::knowledge::containers::IntegerVector3D, madara::knowledge::containers::String, madara::knowledge::containers::IntegerVector2D, madara::knowledge::containers::DoubleVector2D, madara::knowledge::containers::Barrier, madara::knowledge::containers::NativeDoubleVector, madara::knowledge::containers::NativeDoubleVectorStaged, madara::knowledge::containers::NativeIntegerVector, madara::knowledge::containers::NativeIntegerVectorStaged, and madara::knowledge::containers::Collection.

bool madara::knowledge::containers::BaseContainer::modify_if_false ( BaseContainer conditional)
virtual

Modifies the container if the argument is false.

Parameters
conditionalthe container that must be false to modify
Returns
true if the container was modified

Definition at line 64 of file BaseContainer.cpp.

bool madara::knowledge::containers::BaseContainer::modify_if_true ( BaseContainer conditional)
virtual

Modifies the container if the argument is true.

Parameters
conditionalthe container that must be true to modify
Returns
true if the container was modified

Definition at line 44 of file BaseContainer.cpp.

void madara::knowledge::containers::BaseContainer::set_settings ( const KnowledgeUpdateSettings settings)

Sets the update settings for the container.

Parameters
settingsthe new settings to use

Definition at line 28 of file BaseContainer.cpp.

Friends And Related Function Documentation

friend class Collection
friend

Allow Collection class to access protected/private areas.

Definition at line 37 of file BaseContainer.h.

Member Data Documentation

ThreadSafeContext* madara::knowledge::containers::BaseContainer::context_
protected

Variable context that we are modifying.

Definition at line 146 of file BaseContainer.h.

MADARA_LOCK_TYPE madara::knowledge::containers::BaseContainer::mutex_
mutableprotected

guard for access and changes

Mutex for local changes

Definition at line 141 of file BaseContainer.h.

std::string madara::knowledge::containers::BaseContainer::name_
protected

Prefix of variable.

Definition at line 151 of file BaseContainer.h.

KnowledgeUpdateSettings madara::knowledge::containers::BaseContainer::settings_
protected

Settings for modifications.

Definition at line 156 of file BaseContainer.h.


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