1 : |
agomez |
1 |
#ifndef parameter_h
|
2 : |
|
|
#define parameter_h
|
3 : |
|
|
|
4 : |
|
|
#include "commentstream.h" |
5 : |
|
|
#include "gadget.h" |
6 : |
|
|
|
7 : |
|
|
/**
|
8 : |
|
|
* \class Parameter
|
9 : |
|
|
* \brief This is the class used to store the name of a variable used in the model simulation
|
10 : |
|
|
*/
|
11 : |
|
|
class Parameter {
|
12 : |
|
|
public:
|
13 : |
|
|
/**
|
14 : |
|
|
* \brief This is the default Parameter constructor
|
15 : |
|
|
*/
|
16 : |
|
|
Parameter() { name = NULL; };
|
17 : |
|
|
/**
|
18 : |
|
|
* \brief This is the Parameter constructor that creates a copy of an existing Parameter
|
19 : |
|
|
* \param p is the Parameter to copy
|
20 : |
|
|
*/
|
21 : |
|
|
Parameter(const Parameter& p);
|
22 : |
|
|
/**
|
23 : |
|
|
* \brief This is the Parameter constructor for a given string value
|
24 : |
|
|
* \param value is the string value that will be set to the name of the Parameter
|
25 : |
|
|
*/
|
26 : |
|
|
Parameter(char* value);
|
27 : |
|
|
/**
|
28 : |
|
|
* \brief This is the default Parameter destructor
|
29 : |
|
|
*/
|
30 : |
|
|
~Parameter();
|
31 : |
|
|
/**
|
32 : |
|
|
* \brief This function will return the name of the Parameter
|
33 : |
|
|
* \return name
|
34 : |
|
|
*/
|
35 : |
|
|
char* getName() const { return name; };
|
36 : |
|
|
/**
|
37 : |
|
|
* \brief This operator will read data from a CommentStream into a Parameter
|
38 : |
|
|
* \param infile is the CommentStream to read from
|
39 : |
|
|
* \param p is the Parameter used to store the data
|
40 : |
|
|
*/
|
41 : |
|
|
friend CommentStream& operator >> (CommentStream& infile, Parameter& p);
|
42 : |
|
|
/**
|
43 : |
|
|
* \brief This operator will read data from a istream into a Parameter
|
44 : |
|
|
* \param infile is the istream to read from
|
45 : |
|
|
* \param p is the Parameter used to store the data
|
46 : |
|
|
*/
|
47 : |
|
|
friend istream& operator >> (istream& infile, Parameter& p);
|
48 : |
|
|
/**
|
49 : |
|
|
* \brief This operator will set the Parameter equal to an existing Parameter
|
50 : |
|
|
* \param p is the Parameter to copy
|
51 : |
|
|
*/
|
52 : |
|
|
Parameter& operator = (const Parameter& p);
|
53 : |
|
|
/**
|
54 : |
|
|
* \brief This operator will check to see if the Parameter is equal to an existing Parameter
|
55 : |
|
|
* \param p is the Parameter to check
|
56 : |
|
|
* \return 1 if the two Parameters are equal, 0 otherwise
|
57 : |
|
|
*/
|
58 : |
|
|
int operator == (const Parameter& p) const;
|
59 : |
|
|
/**
|
60 : |
|
|
* \brief This function will check to see if the string that is going to be the name of the Parameter is valid or not
|
61 : |
|
|
* \return 1 if the name is valid, 0 otherwise
|
62 : |
|
|
*/
|
63 : |
|
|
int isValidName(char* value);
|
64 : |
|
|
private:
|
65 : |
|
|
/**
|
66 : |
|
|
* \brief This function will check to see if a character from the name of the Parameter is valid or not
|
67 : |
|
|
* \return 1 if the character is valid, 0 otherwise
|
68 : |
|
|
* \note Valid characters are alpha-numeric characters, '_' and '.'
|
69 : |
|
|
*/
|
70 : |
|
|
int isValidChar(int c);
|
71 : |
|
|
/**
|
72 : |
|
|
* \brief This is the name of the Parameter
|
73 : |
|
|
*/
|
74 : |
|
|
char* name;
|
75 : |
|
|
};
|
76 : |
|
|
|
77 : |
|
|
#endif
|