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()+
"\"";
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) {
341 result.append((*(
models()[i]))[k].name());
Exception handler interface definition.
Model parameter class interface definition.
Spectral model registry class definition.
Abstract spectral model base class interface definition.
Interface definition for the spectral model registry class.
void free_members(void)
Delete class members.
virtual ~GModelSpectralRegistry(void)
Destructor.
std::string print(const GChatter &chatter=NORMAL) const
Print registry information.
static GRegistryPointer< const GModelSpectral * > & models()
GModelSpectralRegistry & operator=(const GModelSpectralRegistry ®istry)
Assignment operator.
GModelSpectral * alloc(const GXmlElement &xml) const
Allocate spectral model that is found in XML element.
void init_members(void)
Initialise class members.
GModelSpectralRegistry(void)
Void constructor.
int size(void) const
Return number of registered models.
void copy_members(const GModelSpectralRegistry ®istry)
Copy class members.
std::string name(const int &index) const
Returns model name.
Abstract spectral model base class.
virtual void read(const GXmlElement &xml)=0
virtual GModelSpectral * clone(void) const =0
Clones object.
virtual std::string type(void) const =0
const GXmlAttribute * attribute(const int &index) const
Return attribute.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
bool xml_has_par(const GXmlElement &xml, const std::string &name)
Checks if parameter with given name in XML element exists.