mirror of
https://github.com/nasa/trick.git
synced 2025-01-02 11:26:43 +00:00
19025d77ad
Reorganized. Created a new top level include directory that will hold all of Trick's header files. Moved all of the Trick headers to this directory. Created a libexec directory that holds all of the executables that users don't need to execute directly. Changed all of the executables remaining in bin to start with "trick-". In the sim_services directories changed all source files to find the Trick headers in their new location. Since all of the include files are gone in sim_services, removed the src directories as well, moving all of the source files up a level. Moved the makefiles, docs, man, and other architecture independent files into a top level share directory. Renamed lib_${TRICK_HOST_CPU} to lib64 or lib depending on the platform we're currently on. refs #63
71 lines
1.9 KiB
C++
71 lines
1.9 KiB
C++
|
|
/**
|
|
* Provides a map of class/struct attributes and enumeration attributes
|
|
*/
|
|
|
|
#ifndef ENUMATTRIBUTESMAP_HH
|
|
#define ENUMATTRIBUTESMAP_HH
|
|
|
|
#include <map>
|
|
#include <string>
|
|
#include <fstream>
|
|
#include "trick/attributes.h"
|
|
|
|
namespace Trick {
|
|
|
|
/**
|
|
* These maps stores all the attributes by class/struct/enum name
|
|
* So these 2 classes could inherit from a template or something fancy, but
|
|
* they are so simple I decided to leave them separate.
|
|
*/
|
|
|
|
class EnumAttributesMap {
|
|
|
|
public:
|
|
/**
|
|
* Returns a pointer to the singleton Trick::AttributesMap instance.
|
|
* @return A pointer to Trick::AttributesMap.
|
|
*/
|
|
static EnumAttributesMap * attributes_map() {
|
|
if ( pInstance == NULL ) {
|
|
pInstance = new Trick::EnumAttributesMap() ;
|
|
}
|
|
return pInstance ;
|
|
}
|
|
|
|
EnumAttributesMap() {} ;
|
|
~EnumAttributesMap() {} ;
|
|
|
|
/**
|
|
* Adds a type and the corresponding attributes
|
|
* @param type The name of the type.
|
|
* @param attr Pointer to the attributes.
|
|
*/
|
|
void add_attr( std::string type , ENUM_ATTR * attr ) {
|
|
name_to_attr_map[type] = attr ;
|
|
}
|
|
|
|
/**
|
|
* Gets the attributes of a type.
|
|
* @param type The name of the type.
|
|
* @return The attributes of the type.
|
|
*/
|
|
ENUM_ATTR * get_attr( std::string type ) {
|
|
if ( name_to_attr_map.find(type) != name_to_attr_map.end() ) {
|
|
return name_to_attr_map[type] ;
|
|
}
|
|
return NULL ;
|
|
}
|
|
|
|
void print_xml( std::ofstream & outfile ) ;
|
|
|
|
private:
|
|
std::map<std::string, ENUM_ATTR *> name_to_attr_map ;
|
|
static EnumAttributesMap * pInstance ;
|
|
|
|
} ;
|
|
}
|
|
|
|
#endif
|
|
|