36 #define G_NAME "GModelRegistry::name(int&)"
43 #define G_DEBUG_REGISTRY 0
62 std::cout <<
"GModelRegistry(void): ";
63 for (
int i = 0; i <
size(); ++i) {
64 std::cout <<
"\"" <<
names()[i] <<
"\" ";
66 std::cout << std::endl;
89 std::cout <<
"GModelRegistry(const GModel*): ";
90 std::cout <<
"add \"" << model->
type() <<
"\" to registry." << std::endl;
94 std::string* new_names =
new std::string[
size()+1];
98 for (
int i = 0; i <
size(); ++i) {
99 new_names[i] =
names()[i];
100 new_models[i] =
models()[i];
105 new_models[
size()] = model;
108 names().assign(new_names);
109 models().assign(new_models);
116 std::cout <<
"GModelRegistry(const GModel*): ";
117 for (
int i = 0; i <
size(); ++i) {
118 std::cout <<
"\"" <<
names()[i] <<
"\" ";
120 std::cout << std::endl;
174 if (
this != ®istry) {
213 for (
int i = 0; i <
size(); ++i) {
215 model =
models()[i]->clone();
237 #if defined(G_RANGE_CHECK)
238 if (index < 0 || index >=
size()) {
244 return (
names()[index]);
263 result.append(
"=== GModelRegistry ===");
271 for (
int i = 0; i <
size(); ++i) {
273 result.append(
models()[i]->type());
void init_members(void)
Initialise class members.
static GRegistryPointer< const GModel * > & models()
Interface definition for the model registry class.
std::string name(const int &index) const
Returns model name.
void copy_members(const GModelRegistry ®istry)
Copy class members.
int size(void) const
Return number of registered models.
GModelRegistry(void)
Void constructor.
std::string print(const GChatter &chatter=NORMAL) const
Print registry information.
GModel * alloc(const std::string &name) const
Allocate model of given name.
virtual std::string type(void) const =0
Exception handler interface definition.
GModelRegistry & operator=(const GModelRegistry ®istry)
Assignment operator.
Model registry class definition.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
static GRegistryPointer< std::string > & names()
virtual ~GModelRegistry(void)
Destructor.
void free_members(void)
Delete class members.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.