GAMS  1.4.0
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

◆ Class_ID

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

◆ Containerize()

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

Constructor.

◆ ~Containerize()

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

Destructor.

Member Function Documentation

◆ check_valid_type()

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.

◆ from_container() [1/2]

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

◆ from_container() [2/2]

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

◆ from_container_impl()

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.

◆ get_name()

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

Get name of the object.

Returns
name of the object

◆ get_type()

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

◆ is_valid_type()

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

◆ modify()

void gams::utility::Containerize::modify ( )

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

◆ set_knowledge_base()

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

Set knowledge base to use.

◆ set_name()

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

Set name of the object.

Parameters
nnew name of the object

◆ to_container() [1/2]

void gams::utility::Containerize::to_container ( const std::string &  name = "")

Store object in knowledge base used previously.

Parameters
namelocation of object in Knowlege Base

◆ to_container() [2/2]

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

◆ to_container_impl()

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

◆ name_

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

name of this object

Definition at line 143 of file Containerize.h.

◆ object_type_suffix_

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

object type suffix

Definition at line 140 of file Containerize.h.

◆ prev_kb_

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: