All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HSEPObject.h
Go to the documentation of this file.
1 /*
2  * HSEPObject.h
3  *
4  * This file is part of the HausmiSEP project
5  *
6  * Copyright (C) 2012, 2013 Marco Alvarado (malvcr@gmail.com)
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef HSEPOBJECT_H_
23 #define HSEPOBJECT_H_
24 
25 #include <string>
26 #include <HSEP/ErrorCode.h>
27 
28 using namespace std;
29 
30 namespace HSEP {
31 
37  class HSEPObject {
38 
39  string aType;
40  string aLastError;
41  bool aValid;
42  ErrorCode aLastCode;
44  protected:
45 
50  HSEPObject(const char* pType) {
51  aType = string(pType);
52  aValid = true;
53  aLastCode = EC::NotCatalogedError;
54  } // constructor
55 
56  virtual ~HSEPObject() {
57  } // destructor
58 
63  void setLastError(string& pErrorMsgRef) {
64  aLastError = string(pErrorMsgRef);
65  } // setLastError
66 
70  void setLastError(const string& pErrorMsgRef) {
71  aLastError = string(pErrorMsgRef);
72  } // setLastError
73 
78  void setLastError(const char* pErrorMsg) {
79  aLastError = string(pErrorMsg);
80  } // setLastError
81 
85  void setValid() {
86  aValid = true;
87  } // setValid
88 
92  void setInvalid() {
93  aValid = false;
94  } // setInvalid
95 
100  void setLastCode(const ErrorCode pErrorCode) {
101  aLastCode = pErrorCode;
102  } // setLastCode
103 
104  public:
105 
110  string& lastErrorRef() {
111  return aLastError;
112  } // lastError
113 
119  return aLastCode;
120  } // lastCode
121 
127  bool valid() {
128  return aValid;
129  } // valid
130 
135  string& typeRef() {
136  return aType;
137  } // aType
138 
139  }; // HSEPObject class
140 
141 } // HSEP namespace
142 
143 #endif /* HSEPOBJECT_H_ */