torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Written.cpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 #include "torc/generic/Written.hpp"
17 #include "torc/generic/Status.hpp"
18 
19 namespace torc {
20 namespace generic {
21 
22 /**
23  * Create a written.
24  *
25  * @param[in] inTimeStamp TimeStamp in Universal Time Coordinate.
26  * @param[in] inStatusPtr Pointer to parented(Status) object.
27  * @param[in] inAuthorName Name of the author
28  * @param[in] inProgramName Name of the program
29  * @param[in] inProgramVersion Version of the program
30  * @param[in] inDataOriginLocName Data Origin Location Name
31  * @param[in] inDataOriginVersion Version of the DataOrigin
32  *
33  * @return Pointer to created written.
34  **/
36  const StatusSharedPtr& inStatusPtr, const std::string& inAuthorName,
37  const std::string& inProgramName, const std::string& inProgramVersion,
38  const std::string& inDataOriginLocName, const std::string& inDataOriginVersion) throw (Error) {
39  try {
40  WrittenSharedPtr newWritten;
41  create(newWritten);
42  newWritten->setTimeStamp(inTimeStamp);
43  newWritten->setAuthorName(inAuthorName);
44  newWritten->setProgramName(inProgramName);
45  newWritten->setProgramVersion(inProgramVersion);
46  newWritten->setDataOriginLocationName(inDataOriginLocName);
47  newWritten->setDataOriginVersion(inDataOriginVersion);
48  if(inStatusPtr) {
49  inStatusPtr->addWritten(newWritten);
50  }
51  return newWritten;
52  } catch(Error& e) {
53  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
54  throw;
55  }
56 }
57 
58 /**
59  * Set time stamp
60  *
61  * @param[in] inTimeStamp TimeStamp in Universal Time Coordinate.
62  */
63 void Written::setTimeStamp(const TimeStamp& inTimeStamp) {
64  mTimeStamp = inTimeStamp;
65 }
66 
67 /**
68  * Set author name
69  *
70  * @param[in] inAuthorName Name of the author
71  */
72 void Written::setAuthorName(const std::string& inAuthorName) {
73  mAuthorName = inAuthorName;
74 }
75 
76 /**
77  * Set program name
78  *
79  * @param[in] inProgramName Name of the program
80  */
81 void Written::setProgramName(const std::string& inProgramName) {
82  mProgramName = inProgramName;
83 }
84 
85 /**
86  * Set program version
87  *
88  * @param[in] inProgramVersion Version of the program
89  */
90 void Written::setProgramVersion(const std::string& inProgramVersion) {
91  mProgramVersion = inProgramVersion;
92 }
93 
94 /**
95  * Set Data origin location name
96  *
97  * @param[in] value Data Origin Location Name
98  */
100  mDataOriginLocationName = value;
101 }
102 
103 /**
104  * Set DataOrigin version
105  *
106  * @param[in] inDataOriginVersion Version of the DataOrigin
107  */
108 void Written::setDataOriginVersion(const std::string& inDataOriginVersion) {
109  mDataOriginVersion = inDataOriginVersion;
110 }
111 
113  SelfReferencing<Written>(), mTimeStamp(), mAuthorName(), mProgramName(), mProgramVersion(),
114  mDataOriginLocationName(), mDataOriginVersion() {}
115 
116 Written::~Written() throw () {}
117 
118 } // namespace generic
119 } // namespace torc
Represents objects that have properties.
std::string mDataOriginLocationName
Definition: Written.hpp:162
void setProgramName(const std::string &inProgramName)
Definition: Written.cpp:81
void setDataOriginLocationName(const std::string &value)
Definition: Written.cpp:99
void setAuthorName(const std::string &inAuthorName)
Definition: Written.cpp:72
Represents all classes that can hold user comments.
Definition: Commentable.hpp:36
boost::shared_ptr< Written > WrittenSharedPtr
Represents class that can hold userData.
std::string string
void setTimeStamp(const TimeStamp &inTimeStamp)
Definition: Written.cpp:63
Represents an information container relating to the writer of the EDIF file.
Definition: Written.hpp:33
The Error object thrown by different methods of EdifOM.
Definition: Error.hpp:41
Represents the time in Universal Time Coordinate (year, month, day, hour, minute, second) ...
Definition: TimeStamp.hpp:29
void setDataOriginVersion(const std::string &inDataOriginVersion)
Definition: Written.cpp:108
virtual WrittenSharedPtr newWrittenPtr(const TimeStamp &inTimeStamp, const StatusSharedPtr &inStatusPtr, const std::string &inAuthorName=std::string(), const std::string &inProgramName=std::string(), const std::string &inProgramVersion=std::string(), const std::string &inDataOriginLocName=std::string(), const std::string &inDataOriginVersion=std::string())
Definition: Written.cpp:35
std::string mProgramName
Definition: Written.hpp:160
void setProgramVersion(const std::string &inProgramVersion)
Definition: Written.cpp:90
std::string mAuthorName
Definition: Written.hpp:159
boost::shared_ptr< Status > StatusSharedPtr
std::string mProgramVersion
Definition: Written.hpp:161
std::string mDataOriginVersion
Definition: Written.hpp:163
void setCurrentLocation(const std::string &inFunction, const std::string &inFile, uint32_t inLine)
Definition: Error.cpp:73