GAMS  1.2.2
gams::utility::Containerize Class Referenceabstract

A class meant to assist with retrieving information into GAMS containers. More...

#include <Containerize.h>

Inheritance diagram for gams::utility::Containerize:
gams::pose::Region gams::pose::SearchArea gams::pose::PrioritizedRegion

Public Member Functions

 Containerize (const std::string &n="")
 Constructor. More...
 
virtual ~Containerize ()
 Destructor. More...
 
bool from_container (const std::string &name="")
 Load object from knowledge base. More...
 
bool from_container (madara::knowledge::KnowledgeBase &kb, const std::string &name="")
 Load object from knowledge base. More...
 
std::string get_name () const
 Get name of the object. More...
 
void modify ()
 Resend the information in the container using same knowledge base as previous to_container. More...
 
void set_knowledge_base (madara::knowledge::KnowledgeBase *kb)
 Set knowledge base to use. More...
 
void set_name (const std::string &n)
 Set name of the object. More...
 
void to_container (const std::string &name="")
 Store object in knowledge base used previously. More...
 
void to_container (madara::knowledge::KnowledgeBase &kb, const std::string &name="")
 Store object in knowledge base. More...
 

Protected Types

enum  Class_ID { REGION_TYPE_ID = 0x00000001, PRIORITIZED_REGION_TYPE_ID = 0x00000002, SEARCH_AREA_TYPE_ID = 0x00000004, INVALID = 0x80000000 }
 These are used to check on the type of the object in from_container. More...
 

Protected Member Functions

bool is_valid_type (madara::knowledge::KnowledgeBase &kb, const std::string &name, const Class_ID &expected) const
 Check if the type is correct. More...
 

Static Protected Member Functions

static Class_ID get_type (madara::knowledge::KnowledgeBase &kb, const std::string &name)
 Gets type of object in database. More...
 

Protected Attributes

std::string name_
 name of this object More...
 
madara::knowledge::KnowledgeBase * prev_kb_
 previous knowledge base used for sending objects More...
 

Static Protected Attributes

static const std::string object_type_suffix_
 object type suffix More...
 

Private Member Functions

virtual bool check_valid_type (madara::knowledge::KnowledgeBase &kb, const std::string &name) const =0
 Check if object is of correct type. More...
 
virtual bool from_container_impl (madara::knowledge::KnowledgeBase &kb, const std::string &name)=0
 Load object from knowledge base. More...
 
virtual void to_container_impl (madara::knowledge::KnowledgeBase &kb, const std::string &name)=0
 Store object in knowledge base. More...
 

Detailed Description

A class meant to assist with retrieving information into GAMS containers.

Definition at line 71 of file Containerize.h.

Member Enumeration Documentation

These are used to check on the type of the object in from_container.

When inheriting from this class, add your new class to this list to check for your unique ID. Assign this value in the knowledge base to "prefix + object_type_suffix"

Enumerator
REGION_TYPE_ID 
PRIORITIZED_REGION_TYPE_ID 
SEARCH_AREA_TYPE_ID 
INVALID 

Definition at line 154 of file Containerize.h.

Constructor & Destructor Documentation

gams::utility::Containerize::Containerize ( const std::string &  n = "")

Constructor.

virtual gams::utility::Containerize::~Containerize ( )
virtual

Destructor.

Member Function Documentation

virtual bool gams::utility::Containerize::check_valid_type ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  name 
) const
privatepure virtual

Check if object is of correct type.

Parameters
kbKnowledge Base with object
namePrefix of object in the KB
Returns
true if name is a valid object type in kb

Implemented in gams::pose::SearchArea, gams::pose::Region, and gams::pose::PrioritizedRegion.

bool gams::utility::Containerize::from_container ( const std::string &  name = "")

Load object from knowledge base.

Parameters
namelocation of object in Knowlege Base
Returns
true if object successfully loaded from knowledge base
bool gams::utility::Containerize::from_container ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  name = "" 
)

Load object from knowledge base.

Parameters
kbKnowledge Base with object
namelocation of object in Knowlege Base
Returns
true if object successfully loaded from knowledge base
virtual bool gams::utility::Containerize::from_container_impl ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  name 
)
privatepure virtual

Load object from knowledge base.

Parameters
kbKnowledge Base with object
namelocation of object in Knowlege Base

Implemented in gams::pose::SearchArea, gams::pose::Region, and gams::pose::PrioritizedRegion.

std::string gams::utility::Containerize::get_name ( ) const

Get name of the object.

Returns
name of the object
static Class_ID gams::utility::Containerize::get_type ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  name 
)
staticprotected

Gets type of object in database.

Parameters
kbKnowledge Base with object
namePrefix of object in the KB
Returns
Class_ID of object in kb
bool gams::utility::Containerize::is_valid_type ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  name,
const Class_ID expected 
) const
protected

Check if the type is correct.

Parameters
kbKnowledge Base with object
namePrefix of object in the KB
expectedExpected value
Returns
true if correct type, false otherwise
void gams::utility::Containerize::modify ( )

Resend the information in the container using same knowledge base as previous to_container.

void gams::utility::Containerize::set_knowledge_base ( madara::knowledge::KnowledgeBase *  kb)

Set knowledge base to use.

void gams::utility::Containerize::set_name ( const std::string &  n)

Set name of the object.

Parameters
nnew name of the object
void gams::utility::Containerize::to_container ( const std::string &  name = "")

Store object in knowledge base used previously.

Parameters
namelocation of object in Knowlege Base
void gams::utility::Containerize::to_container ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  name = "" 
)

Store object in knowledge base.

Parameters
kbKnowledge Base to store object in
namelocation of object in Knowlege Base
virtual void gams::utility::Containerize::to_container_impl ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  name 
)
privatepure virtual

Store object in knowledge base.

Parameters
kbKnowledge Base to store object in
namelocation of object in Knowlege Base

Implemented in gams::pose::SearchArea, gams::pose::Region, and gams::pose::PrioritizedRegion.

Member Data Documentation

std::string gams::utility::Containerize::name_
protected

name of this object

Definition at line 143 of file Containerize.h.

const std::string gams::utility::Containerize::object_type_suffix_
staticprotected

object type suffix

Definition at line 140 of file Containerize.h.

madara::knowledge::KnowledgeBase* gams::utility::Containerize::prev_kb_
protected

previous knowledge base used for sending objects

Definition at line 146 of file Containerize.h.


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