Graphite  Version 3
An experimental 3D geometry processing program
meta_arg.h
Go to the documentation of this file.
1 /*
2  * GXML/Graphite: Geometry and Graphics Programming Library + Utilities
3  * Copyright (C) 2000 Bruno Levy
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  * If you modify this software, you should include a notice giving the
20  * name of the person performing the modification, the date of modification,
21  * and the reason for such modification.
22  *
23  * Contact: Bruno Levy
24  *
25  * levy@loria.fr
26  *
27  * ISA Project
28  * LORIA, INRIA Lorraine,
29  * Campus Scientifique, BP 239
30  * 54506 VANDOEUVRE LES NANCY CEDEX
31  * FRANCE
32  *
33  * Note that the GNU General Public License does not permit incorporating
34  * the Software into proprietary programs.
35  */
36 
37 #ifndef H_OGF_GOM_REFLECTION_META_ARG_H
38 #define H_OGF_GOM_REFLECTION_META_ARG_H
39 
40 #include <OGF/gom/common/common.h>
42 
43 #include <string>
44 #include <vector>
45 
51 namespace OGF {
52 
53  class MetaType ;
54 
55 //______________________________________________________________
56 
60  class GOM_API MetaArg : public CustomAttributes {
61  public:
62 
68  MetaArg(const std::string& name, const std::string& type_name) ;
69 
75  MetaArg(const std::string& name, MetaType* type) ;
76 
81  const std::string& name() const {
82  return name_ ;
83  }
84 
89  const std::string& type_name() const {
90  return type_name_ ;
91  }
92 
97  MetaType* type() const;
98 
104  bool has_default_value() const {
105  return !default_value_.is_null();
106  }
107 
113  const Any& default_value() const {
114  return default_value_ ;
115  }
116 
123  return default_value_;
124  }
125 
126  private:
127  std::string name_ ;
128  std::string type_name_ ;
129  Any default_value_;
130  } ;
131 
135  typedef std::vector<MetaArg> MetaArgList ;
136 //______________________________________________________________
137 
138 }
139 #endif
140 
A class that stores a variable of arbitrary type.
Definition: any.h:62
Stores a set of custom attributes, i.e. name-value pairs attached to the objects.
Definition: meta_type.h:63
The representation of the arguments in the Meta repository.
Definition: meta_arg.h:60
bool has_default_value() const
Tests whether the argument has a default value.
Definition: meta_arg.h:104
MetaArg(const std::string &name, const std::string &type_name)
Constructs a new MetaArg.
MetaArg(const std::string &name, MetaType *type)
Constructs a new MetaArg.
const Any & default_value() const
Gets the default value of an argument.
Definition: meta_arg.h:113
const std::string & type_name() const
Gets the type name name.
Definition: meta_arg.h:89
const std::string & name() const
Gets the name.
Definition: meta_arg.h:81
Any & default_value()
Gets the default value of an argument.
Definition: meta_arg.h:122
MetaType * type() const
Gets the type.
The representation of a type in the Meta repository.
Definition: meta_type.h:221
Base class for meta informations.
Global Graphite namespace.
Definition: common.h:76
std::vector< MetaArg > MetaArgList
Meta representation of a list of arguments.
Definition: meta_arg.h:135
Definitions common to all include files in the gom library.