00001 // Study.cpp 00002 00003 #include <sstream> 00004 00005 #include "Study.h" 00006 00007 using namespace Yosokumo; 00008 00009 // Constructors 00010 00011 Study::Study() 00012 { 00013 initStudy(); 00014 } 00015 00016 Study::Study 00017 ( 00018 const std::string &studyName, 00019 Type type, 00020 Status status, 00021 Visibility visibility 00022 ) 00023 { 00024 initStudy(); 00025 00026 this->studyName = studyName; 00027 this->type = type; 00028 this->status = status; 00029 this->visibility = visibility; 00030 } 00031 00032 Study::Study(const Study &rhs) 00033 { 00034 operator=(rhs); 00035 } 00036 00037 Study::~Study() 00038 {} 00039 00040 Study &Study::operator=(const Study& rhs) 00041 { 00042 if (this == &rhs) 00043 return *this; 00044 00045 copyStudy(*this, rhs); 00046 00047 return *this; 00048 } 00049 00050 00051 // Equality operators 00052 00053 bool Study::operator==(const Study &rhs) const 00054 { 00055 return 00056 ( 00057 studyIdentifier == rhs.studyIdentifier && 00058 studyName == rhs.studyName && 00059 studyLocation == rhs.studyLocation && 00060 00061 type == rhs.type && 00062 status == rhs.status && 00063 visibility == rhs.visibility && 00064 00065 ownerIdentifier == rhs.ownerIdentifier && 00066 ownerName == rhs.ownerName && 00067 00068 tableLocation == rhs.tableLocation && 00069 modelLocation == rhs.modelLocation && 00070 panelLocation == rhs.panelLocation && 00071 rosterLocation == rhs.rosterLocation && 00072 00073 // Panel info 00074 00075 nameControlLocation == rhs.nameControlLocation && 00076 statusControlLocation == rhs.statusControlLocation && 00077 visibilityControlLocation == rhs.visibilityControlLocation && 00078 00079 blockCount == rhs.blockCount && 00080 cellCount == rhs.cellCount && 00081 prospectCount == rhs.prospectCount && 00082 00083 creationTime == rhs.creationTime && 00084 latestBlockTime == rhs.latestBlockTime && 00085 latestProspectTime == rhs.latestProspectTime 00086 ); 00087 } 00088 00089 bool Study::operator!=(const Study &rhs) const 00090 { 00091 return !(*this == rhs); 00092 } 00093 00094 00095 void Study::initStudy() 00096 { 00097 studyIdentifier = ""; 00098 studyName = ""; 00099 studyLocation = ""; 00100 type = NUMBER; 00101 status = RUNNING; 00102 visibility = PRIVATE; 00103 ownerIdentifier = ""; 00104 ownerName = ""; 00105 tableLocation = ""; 00106 modelLocation = ""; 00107 panelLocation = ""; 00108 rosterLocation = ""; 00109 nameControlLocation = ""; 00110 statusControlLocation = ""; 00111 visibilityControlLocation = ""; 00112 blockCount = 0; 00113 cellCount = 0; 00114 prospectCount = 0; 00115 creationTime = ""; 00116 latestBlockTime = ""; 00117 latestProspectTime = ""; 00118 } 00119 00120 // Copy one study to another 00121 00122 void Study::copyStudy(Study &t, const Study &s) 00123 { 00124 t.setStudyIdentifier(s.getStudyIdentifier()); 00125 t.setStudyName (s.getStudyName() ); 00126 t.setStudyLocation (s.getStudyLocation() ); 00127 t.setType (s.getType() ); 00128 t.setStatus (s.getStatus() ); 00129 t.setVisibility (s.getVisibility() ); 00130 t.setOwnerIdentifier(s.getOwnerIdentifier()); 00131 t.setOwnerName (s.getOwnerName() ); 00132 t.setTableLocation (s.getTableLocation() ); 00133 t.setModelLocation (s.getModelLocation() ); 00134 t.setPanelLocation (s.getPanelLocation() ); 00135 t.setRosterLocation (s.getRosterLocation() ); 00136 00137 // Panel info 00138 00139 t.setNameControlLocation (s.getNameControlLocation() ); 00140 t.setStatusControlLocation (s.getStatusControlLocation() ); 00141 t.setVisibilityControlLocation(s.getVisibilityControlLocation()); 00142 t.setBlockCount (s.getBlockCount() ); 00143 t.setCellCount (s.getCellCount() ); 00144 t.setProspectCount (s.getProspectCount() ); 00145 t.setCreationTime (s.getCreationTime() ); 00146 t.setLatestBlockTime (s.getLatestBlockTime() ); 00147 t.setLatestProspectTime (s.getLatestProspectTime() ); 00148 00149 } // end copyStudy 00150 00151 // Setters and getters 00152 00153 void Study::setStudyIdentifier(const std::string &id) 00154 { 00155 studyIdentifier = id; 00156 } 00157 00158 std::string Study::getStudyIdentifier() const 00159 { 00160 return studyIdentifier; 00161 } 00162 00163 void Study::setStudyName(const std::string &name) 00164 { 00165 studyName = name; 00166 } 00167 00168 std::string Study::getStudyName() const 00169 { 00170 return studyName; 00171 } 00172 00173 void Study::setStudyLocation(const std::string &loc) 00174 { 00175 studyLocation = loc; 00176 } 00177 00178 std::string Study::getStudyLocation() const 00179 { 00180 return studyLocation; 00181 } 00182 00183 void Study::setType(Type t) 00184 { 00185 type = t; 00186 } 00187 00188 Study::Type Study::getType() const 00189 { 00190 return type; 00191 } 00192 00193 void Study::setStatus(Status s) 00194 { 00195 status = s; 00196 } 00197 00198 Study::Status Study::getStatus() const 00199 { 00200 return status; 00201 } 00202 00203 void Study::setVisibility(Visibility v) 00204 { 00205 visibility = v; 00206 } 00207 00208 Study::Visibility Study::getVisibility() const 00209 { 00210 return visibility; 00211 } 00212 00213 void Study::setOwnerIdentifier(const std::string &id) 00214 { 00215 ownerIdentifier = id; 00216 } 00217 00218 std::string Study::getOwnerIdentifier() const 00219 { 00220 return ownerIdentifier; 00221 } 00222 00223 void Study::setOwnerName(const std::string &name) 00224 { 00225 ownerName = name; 00226 } 00227 00228 std::string Study::getOwnerName() const 00229 { 00230 return ownerName; 00231 } 00232 00233 void Study::setTableLocation(const std::string &loc) 00234 { 00235 tableLocation = loc; 00236 } 00237 00238 std::string Study::getTableLocation() const 00239 { 00240 return tableLocation; 00241 } 00242 00243 void Study::setModelLocation(const std::string &loc) 00244 { 00245 modelLocation = loc; 00246 } 00247 00248 std::string Study::getModelLocation() const 00249 { 00250 return modelLocation; 00251 } 00252 00253 void Study::setPanelLocation(const std::string &loc) 00254 { 00255 panelLocation = loc; 00256 } 00257 00258 std::string Study::getPanelLocation() const 00259 { 00260 return panelLocation; 00261 } 00262 00263 void Study::setRosterLocation(const std::string &loc) 00264 { 00265 rosterLocation = loc; 00266 } 00267 00268 std::string Study::getRosterLocation() const 00269 { 00270 return rosterLocation; 00271 } 00272 00273 // Panel setters and getters 00274 00275 void Study::setNameControlLocation(const std::string &nameControlLocation) 00276 { 00277 this->nameControlLocation = nameControlLocation; 00278 } 00279 00280 std::string Study::getNameControlLocation() const 00281 { 00282 return nameControlLocation; 00283 } 00284 00285 void Study::setStatusControlLocation(const std::string &statusControlLocation) 00286 { 00287 this->statusControlLocation = statusControlLocation; 00288 } 00289 00290 std::string Study::getStatusControlLocation() const 00291 { 00292 return statusControlLocation; 00293 } 00294 00295 void Study::setVisibilityControlLocation(const std::string &visibilityControlLocation) 00296 { 00297 this->visibilityControlLocation = visibilityControlLocation; 00298 } 00299 00300 std::string Study::getVisibilityControlLocation() const 00301 { 00302 return visibilityControlLocation; 00303 } 00304 00305 void Study::setBlockCount(uint64_t blockCount) 00306 { 00307 this->blockCount = blockCount; 00308 } 00309 00310 uint64_t Study::getBlockCount() const 00311 { 00312 return blockCount; 00313 } 00314 00315 void Study::setCellCount(uint64_t cellCount) 00316 { 00317 this->cellCount = cellCount; 00318 } 00319 00320 uint64_t Study::getCellCount() const 00321 { 00322 return cellCount; 00323 } 00324 00325 void Study::setProspectCount(uint64_t prospectCount) 00326 { 00327 this->prospectCount = prospectCount; 00328 } 00329 00330 uint64_t Study::getProspectCount() const 00331 { 00332 return prospectCount; 00333 } 00334 00335 void Study::setCreationTime(const std::string &creationTime) 00336 { 00337 this->creationTime = creationTime; 00338 } 00339 00340 std::string Study::getCreationTime() const 00341 { 00342 return creationTime; 00343 } 00344 00345 void Study::setLatestBlockTime(const std::string &latestBlockTime) 00346 { 00347 this->latestBlockTime = latestBlockTime; 00348 } 00349 00350 std::string Study::getLatestBlockTime() const 00351 { 00352 return latestBlockTime; 00353 } 00354 00355 void Study::setLatestProspectTime(const std::string &latestProspectTime) 00356 { 00357 this->latestProspectTime = latestProspectTime; 00358 } 00359 00360 std::string Study::getLatestProspectTime() const 00361 { 00362 return latestProspectTime; 00363 } 00364 00365 // Utility 00366 00367 std::string Study::toString() 00368 { 00369 std::stringstream s; 00370 00371 s << 00372 "Study:" << '\n' << 00373 " studyIdentifier = " << getStudyIdentifier() << '\n' << 00374 " studyName = " << getStudyName() << '\n' << 00375 " studyLocation = " << getStudyLocation() << '\n' << 00376 '\n' << 00377 " type = " << getType() << '\n' << 00378 " status = " << getStatus() << '\n' << 00379 " visibility = " << getVisibility() << '\n' << 00380 '\n' << 00381 " ownerIdentifier = " << getOwnerIdentifier() << '\n' << 00382 " ownerName = " << getOwnerName() << '\n' << 00383 " tableLocation = " << getTableLocation() << '\n' << 00384 " modelLocation = " << getModelLocation() << '\n' << 00385 " panelLocation = " << getPanelLocation() << '\n' << 00386 " rosterLocation = " << getRosterLocation() << '\n' << 00387 '\n' << 00388 " nameControlLocation = " << getNameControlLocation()<< '\n' << 00389 " statusControlLocation = " 00390 << getStatusControlLocation() << '\n' << 00391 " visibilityControlLocation= " 00392 << getVisibilityControlLocation() << '\n' << 00393 '\n' << 00394 " blockCount = " << getBlockCount() << '\n' << 00395 " cellCount = " << getCellCount() << '\n' << 00396 " prospectCount = " << getProspectCount() << '\n' << 00397 '\n' << 00398 " creationTime = " << getCreationTime() << '\n' << 00399 " latestBlockTime = " << getLatestBlockTime() << '\n' << 00400 " latestProspectTime = " << getLatestProspectTime() << '\n' 00401 ; 00402 00403 return s.str(); 00404 00405 } // end toString 00406 00407 // end Study.cpp