Overture  Version 25
ShowFileParameter.h
Go to the documentation of this file.
1 #ifndef SHOW_FILE_PARAMETER_H
2 #define SHOW_FILE_PARAMETER_H
3 
4 #include "Overture.h"
5 
6 // This class defines parameters for use with a show file.
7 // Parameters of type int, real or string can be created, each with a given name.
8 
10 {
11 public:
13  {
17  };
18 
20 
21 ShowFileParameter(const aString & name_, int value);
22 
23 ShowFileParameter(const aString & name_, real value);
24 
25 ShowFileParameter(const aString & name_, const aString & value);
26 
28 
29 ParameterType getType() const;
30 const aString& getName() const;
31 
32 // Return the type and the value. Only one of the values (ivalue,rvalue,stringValue) will make sense,
33 // the one corresponding to the "type"
34 int get( aString & name_, ParameterType & type_, int & ivalue_, real & rvalue_, aString & stringValue_ ) const;
35 
36 int set( const aString & name_, ParameterType type_, int ivalue_, real rvalue_, const aString & stringValue_ );
37 
38 // assign a name and value to a parameter
39 int set(const aString & name_, int value);
40 int set(const aString & name_, real value);
41 int set(const aString & name_, const aString & value);
42 
43 // set a value without changing the name
44 int set(int value);
45 int set(real value);
46 int set(const aString & value);
47 
48 protected:
49 
51 
54  int ivalue;
56 
57 };
58 
59 
60 
61 #ifndef OV_USE_OLD_STL_HEADERS
62 #include <list>
63 #else
64 #include <list.h>
65 #endif
66 
67 class ListOfShowFileParameters : public std::list<ShowFileParameter>
68 {
69  public:
70 
71  // get a parameter with a given name
72  bool getParameter(const aString & name, int & value ) const;
73  bool getParameter(const aString & name, real & value ) const;
74  bool getParameter(const aString & name, aString & value ) const;
75 
76  // get a parameter with a given name and type
77  bool getParameter(const aString & name,
79  int & value,
80  real & rValue,
81  aString & stringValue ) const;
82 
83  // Parse an answer and look for [name value] -- set the value if the name is found
84  bool matchAndSetValue( const aString & answer );
85 
86  // set a parameter with a given name (create the parameter if not found)
87  bool setParameter(const aString & name, const int value );
88  bool setParameter(const aString & name, const real value );
89  bool setParameter(const aString & name, const aString & value );
90 
91 
92 };
93 
94 
95 #endif