38 #define G_ALLOC "GModelSpectralRegistry::alloc(GXmlElement&)"
39 #define G_NAME "GModelSpectralRegistry::name(int&)"
46 #define G_DEBUG_REGISTRY 0
65 std::cout <<
"GModelSpectralRegistry(void): ";
66 for (
int i = 0; i <
size(); ++i) {
67 std::cout <<
"\"" <<
models()[i]->type() <<
"\" ";
69 std::cout << std::endl;
92 std::cout <<
"GModelSpectralRegistry(const GModelSpatial*): ";
93 std::cout <<
"add \"" << model->
type() <<
"\" to registry." << std::endl;
100 for (
int i = 0; i <
size(); ++i) {
101 new_models[i] =
models()[i];
105 new_models[
size()] = model;
108 models().assign(new_models);
115 std::cout <<
"GModelSpectralRegistry(const GModelSpectral*): ";
116 for (
int i = 0; i <
size(); ++i) {
117 std::cout <<
"\"" <<
models()[i]->type() <<
"\" ";
119 std::cout << std::endl;
173 if (
this != ®istry) {
216 std::string missing =
"";
219 for (
int i = 0; i <
size(); ++i) {
230 for (
int k = 0; k <
models()[i]->size(); ++k) {
232 if (missing.length() > 0) {
235 missing +=
"\""+(*(
models()[i]))[k].name()+
"\"";
247 model =
models()[i]->clone();
258 std::string msg =
"";
261 if (missing.length() > 0) {
262 msg =
"Spectral model of type \""+xml.
attribute(
"type")+
"\" found "
263 "but the following parameters are missing: "+missing;
268 msg =
"Spectral model of type \""+xml.
attribute(
"type")+
"\" not "
269 "found in registry. Possible spectral model types are:";
270 for (
int i = 0; i <
size(); ++i) {
271 msg +=
" \""+
models()[i]->type()+
"\"";
301 #if defined(G_RANGE_CHECK)
302 if (index < 0 || index >=
size()) {
309 return (
models()[index]->type());
328 result.append(
"=== GModelSpectralRegistry ===");
334 for (
int i = 0; i <
size(); ++i) {
336 for (
int k = 0; k <
models()[i]->size(); ++k) {
void free_members(void)
Delete class members.
Abstract spectral model base class.
void init_members(void)
Initialise class members.
Spectral model registry class definition.
virtual std::string type(void) const =0
virtual void read(const GXmlElement &xml)=0
static GRegistryPointer< const GModelSpectral * > & models()
Model parameter class interface definition.
GModelSpectralRegistry(void)
Void constructor.
std::string name(const int &index) const
Returns model name.
const GXmlAttribute * attribute(const int &index) const
Return attribute.
std::string print(const GChatter &chatter=NORMAL) const
Print registry information.
GModelSpectral * alloc(const GXmlElement &xml) const
Allocate spectral model that is found in XML element.
Interface definition for the spectral model registry class.
bool xml_has_par(const GXmlElement &xml, const std::string &name)
Checks if parameter with given name in XML element exists.
virtual ~GModelSpectralRegistry(void)
Destructor.
Abstract spectral model base class interface definition.
GModelSpectralRegistry & operator=(const GModelSpectralRegistry ®istry)
Assignment operator.
int size(void) const
Return number of registered models.
Exception handler interface definition.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
void copy_members(const GModelSpectralRegistry ®istry)
Copy class members.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.