graph_analysis
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
graph_analysis::VertexTypeManager Class Reference

Factory for Vertex subclasses. More...

#include <VertexTypeManager.hpp>

Inheritance diagram for graph_analysis::VertexTypeManager:
Inheritance graph
[legend]
Collaboration diagram for graph_analysis::VertexTypeManager:
Collaboration graph
[legend]

Public Types

typedef std::map< vertex::Type, Vertex::Ptr > TypeMap
 
- Public Types inherited from graph_analysis::AttributeManager
typedef std::map< std::string, io::AttributeSerializationCallbacks > AttributeSerializationCallbackMap
 

Public Member Functions

void setDefaultType (const std::string &type)
 
const std::string & getDefaultType () const
 
template<typename T , typename P = graph_analysis::Vertex>
void registerType (bool throwOnAlreadyRegistered=false)
 
void registerType (const Vertex::Ptr &vertex, const Vertex::PtrList &parents=Vertex::PtrList(), bool throwOnAlreadyRegistered=false)
 
void registerType (const vertex::Type &type, const Vertex::Ptr &vertex, const Vertex::PtrList &parents=Vertex::PtrList(), bool throwOnAlreadyRegistered=false)
 
Vertex::Ptr createVertex (const vertex::Type &type, const std::string &label=std::string(), bool throwOnMissing=false)
 clones a new vertex of a specified type More...
 
std::set< std::string > getSupportedTypes () const
 
std::vector< std::string > getTypeHierarchy (const vertex::Type &type) const
 
std::vector< Attribute > getKnownAttributes (const std::set< std::string > &classnames=std::set< std::string >()) const
 
std::vector< Attribute > getAttributes (const vertex::Type &classname, bool includeLegacySupport=false) const
 
std::vector< std::pair< Attribute::Id, std::string > > getAttributeValues (const Vertex::Ptr &vertex) const
 
- Public Member Functions inherited from graph_analysis::AttributeManager
void activateAttributedType (const std::string &typeName)
 
void registerAttribute (const std::string &typeName, const std::string &attributeName, io::AttributeSerializationCallbacks::serialize_func_t sF, io::AttributeSerializationCallbacks::deserialize_func_t dF, io::AttributeSerializationCallbacks::print_func_t pF)
 register a new attribute for serialization and deserialization More...
 
std::vector< std::string > getAttributeNames (const std::string &vertexTypeName) const
 returns all registered members for the given vertex More...
 
io::AttributeSerializationCallbacks getAttributeSerializationCallbacks (const Attribute &attribute) const
 

Protected Member Functions

 VertexTypeManager ()
 constructor More...
 

Friends

class base::Singleton< VertexTypeManager >
 

Detailed Description

Factory for Vertex subclasses.

VertexTypeManager allows to register vertex classes by type

Member Typedef Documentation

◆ TypeMap

Constructor & Destructor Documentation

◆ VertexTypeManager()

graph_analysis::VertexTypeManager::VertexTypeManager ( )
protected

constructor

Member Function Documentation

◆ createVertex()

Vertex::Ptr graph_analysis::VertexTypeManager::createVertex ( const vertex::Type &  type,
const std::string &  label = std::string(),
bool  throwOnMissing = false 
)

clones a new vertex of a specified type

Parameters
typethe requested vertex type
labelthe requested vertex label
throwOnMissingThrow exception when the vertex type is unknown, otherwise a default vertex will be created
Returns
smart pointer to the newly created vertex instance

◆ getAttributes()

std::vector< Attribute > graph_analysis::VertexTypeManager::getAttributes ( const vertex::Type &  classname,
bool  includeLegacySupport = false 
) const

Get all attributes that are associated with a registered type

Parameters
classnameretrieve attributes only for the given classname
See also
AttributeManager::getAttributeName to retrieve information for an individual attribute

◆ getAttributeValues()

std::vector< std::pair< Attribute::Id, std::string > > graph_analysis::VertexTypeManager::getAttributeValues ( const Vertex::Ptr &  vertex) const

Retrieve the attribute data for a particular vertex

Returns
value assignments for the attributes of a vertex

◆ getDefaultType()

const std::string& graph_analysis::VertexTypeManager::getDefaultType ( ) const
inline

Get the default vertex type

◆ getKnownAttributes()

std::vector< Attribute > graph_analysis::VertexTypeManager::getKnownAttributes ( const std::set< std::string > &  classnames = std::set<std::string>()) const

Get all attributes that are associated with the registered types

Parameters
classnamesgenerate the known attributes only for the given classnames
See also
AttributeManager::getAttributes to retrieve information for an individual attribute

◆ getSupportedTypes()

std::set< std::string > graph_analysis::VertexTypeManager::getSupportedTypes ( ) const

Lists the registered types

Returns
list of registered types

◆ getTypeHierarchy()

std::vector< std::string > graph_analysis::VertexTypeManager::getTypeHierarchy ( const vertex::Type &  type) const

Compute the class hierarchy for a given vertex type, note that the type itself will also be part of the returned list

Parameters
typeVertex type for which the hierarchy should be retrieved
Returns
class hierarchy

◆ registerType() [1/3]

template<typename T , typename P = graph_analysis::Vertex>
void graph_analysis::VertexTypeManager::registerType ( bool  throwOnAlreadyRegistered = false)
inline

◆ registerType() [2/3]

void graph_analysis::VertexTypeManager::registerType ( const Vertex::Ptr &  vertex,
const Vertex::PtrList &  parents = Vertex::PtrList(),
bool  throwOnAlreadyRegistered = false 
)

Register vertex class

Parameters
vertexInstance of the registered type
parentsInstances of the parent types
throwOnAlreadyRegisteredIf true, then this function will throw std::runtime_error upon double registration

◆ registerType() [3/3]

void graph_analysis::VertexTypeManager::registerType ( const vertex::Type &  type,
const Vertex::Ptr &  vertex,
const Vertex::PtrList &  parents = Vertex::PtrList(),
bool  throwOnAlreadyRegistered = false 
)

◆ setDefaultType()

void graph_analysis::VertexTypeManager::setDefaultType ( const std::string &  type)

Select the default vertex type from the list of registered types

Friends And Related Function Documentation

◆ base::Singleton< VertexTypeManager >

friend class base::Singleton< VertexTypeManager >
friend

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