TOBI Interface A
0.1
|
00001 /* 00002 This file is part of the TOBI Interface A (TiA) library. 00003 00004 Commercial Usage 00005 Licensees holding valid Graz University of Technology Commercial 00006 licenses may use this file in accordance with the Graz University 00007 of Technology Commercial License Agreement provided with the 00008 Software or, alternatively, in accordance with the terms contained in 00009 a written agreement between you and Graz University of Technology. 00010 00011 -------------------------------------------------- 00012 00013 GNU Lesser General Public License Usage 00014 Alternatively, this file may be used under the terms of the GNU Lesser 00015 General Public License version 3.0 as published by the Free Software 00016 Foundation and appearing in the file lgpl.txt included in the 00017 packaging of this file. Please review the following information to 00018 ensure the GNU General Public License version 3.0 requirements will be 00019 met: http://www.gnu.org/copyleft/lgpl.html. 00020 00021 In case of GNU Lesser General Public License Usage ,the TiA library 00022 is distributed in the hope that it will be useful, 00023 but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00025 GNU General Public License for more details. 00026 00027 You should have received a copy of the GNU Lesser General Public License 00028 along with the TiA library. If not, see <http://www.gnu.org/licenses/>. 00029 00030 Copyright 2010 Graz University of Technology 00031 Contact: TiA@tobi-project.org 00032 */ 00033 00040 #ifndef SERVER_META_INFO_H 00041 #define SERVER_META_INFO_H 00042 00043 #include <boost/cstdint.hpp> 00044 00045 // STL 00046 #include <string> 00047 #include <map> 00048 #include <vector> 00049 00050 namespace tia 00051 { 00052 00053 //----------------------------------------------------------------------------- 00054 00065 class SubjectInfo 00066 { 00067 public: 00068 enum Sex { 00069 Male = 1, 00070 Female = 2 00071 }; 00072 00073 enum Handedness { 00074 RightHanded = 1, 00075 LeftHanded = 2 00076 }; 00077 00081 enum ShortInfoType{ 00082 Glasses = 1, 00083 Smoking 00084 }; 00085 00086 enum ShortInfoValue { 00087 Unknown = 0, 00088 No, 00089 Yes 00090 }; 00091 00092 typedef std::map<ShortInfoType, ShortInfoValue> ShortInfoMap; 00093 00094 public: 00098 std::string id() const { return id_; } 00102 void setId(const std::string& id) { id_ = id; } 00103 00104 std::string firstName() const { return firstname_; } 00105 void setFirstName(const std::string& name) { firstname_ = name; } 00106 00107 std::string surname() const { return surname_; } 00108 void setSurname(const std::string& name) { surname_ = name; } 00109 00110 std::string birthday() const { return birthday_; } 00111 void setBirthday(const std::string& birthday) { birthday_ = birthday; } 00112 00113 int sex() const { return sex_; } 00114 void setSex(int sex) { sex_ = sex; } 00115 00116 int handedness() const { return handedness_; } 00117 void setHandedness(int handedness) { handedness_ = handedness; } 00118 00119 void setMedication(std::string& medication) { medication_ = medication; } 00120 std::string medication() const { return medication_; } 00121 00125 void setShortInfo(ShortInfoType info, ShortInfoValue value) 00126 { 00127 short_infos_[info] = value; 00128 } 00129 00133 ShortInfoValue shortInfo(ShortInfoType info) const 00134 { 00135 ShortInfoMap::const_iterator it = short_infos_.find(info); 00136 if (it == short_infos_.end()) return Unknown; 00137 return (*it).second; 00138 } 00139 00140 ShortInfoMap& shortInfoMap() { return short_infos_; } 00141 00142 const ShortInfoMap& shortInfoMap() const { return short_infos_; } 00143 00144 private: 00145 std::string id_; 00146 std::string firstname_; 00147 std::string surname_; 00148 std::string birthday_; 00149 std::string medication_; 00150 int handedness_; 00151 int sex_; 00152 ShortInfoMap short_infos_; 00153 }; 00154 00155 //----------------------------------------------------------------------------- 00156 00168 class Channel 00169 { 00170 public: 00174 std::string id() const { return id_; } 00178 void setId(const std::string& id) { id_ = id; } 00179 00180 private: 00181 std::string id_; 00182 }; 00183 00184 //----------------------------------------------------------------------------- 00185 00196 class Signal 00197 { 00198 public: 00202 void setType(const std::string& type) { type_ = type; } 00203 00207 std::string type() const { return type_; } 00208 00212 boost::uint16_t blockSize() const { return block_size_; } 00213 00217 void setBlockSize(boost::uint16_t block_size) { block_size_ = block_size; } 00218 00222 boost::uint16_t samplingRate() const { return sampling_rate_; } 00223 00227 void setSamplingRate(boost::uint16_t sampling_rate) { sampling_rate_ = sampling_rate; } 00228 00232 const std::vector<Channel>& channels() const { return channels_; } 00233 00234 std::vector<Channel>& channels() { return channels_; } 00235 00236 private: 00237 std::string type_; 00238 boost::uint16_t block_size_; 00239 boost::uint16_t sampling_rate_; 00240 std::vector<Channel> channels_; 00241 }; 00242 00243 //----------------------------------------------------------------------------- 00244 00254 class SignalInfo 00255 { 00256 public: 00257 typedef std::map<std::string, Signal> SignalMap; 00258 00259 public: 00263 boost::uint16_t masterSamplingRate() const { return master_sampling_rate_; } 00264 00268 void setMasterSamplingRate(boost::uint16_t rate) { master_sampling_rate_ = rate; } 00269 00270 boost::uint16_t masterBlockSize() const { return master_block_size_; } 00271 00272 void setMasterBlockSize(boost::uint16_t size) { master_block_size_ = size; } 00273 00274 const SignalMap& signals() const { return signals_; } 00275 00276 SignalMap& signals() { return signals_; } 00277 00278 private: 00279 boost::uint16_t master_block_size_; 00280 boost::uint16_t master_sampling_rate_; 00281 SignalMap signals_; 00282 }; 00283 00284 } // Namespace tobiss 00285 00286 //----------------------------------------------------------------------------- 00287 00288 #endif // UDPSERVER_H