OpenWalnut  1.4.0
WPersonalInformation.cpp
00001 //---------------------------------------------------------------------------
00002 //
00003 // Project: OpenWalnut ( http://www.openwalnut.org )
00004 //
00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
00006 // For more information see http://www.openwalnut.org/copying
00007 //
00008 // This file is part of OpenWalnut.
00009 //
00010 // OpenWalnut is free software: you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as published by
00012 // the Free Software Foundation, either version 3 of the License, or
00013 // (at your option) any later version.
00014 //
00015 // OpenWalnut is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 // GNU Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public License
00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
00022 //
00023 //---------------------------------------------------------------------------
00024 
00025 #include <string>
00026 
00027 #include "../common/WAssert.h"
00028 #include "WSubject.h"
00029 #include "WPersonalInformation.h"
00030 
00031 WPersonalInformation WPersonalInformation::createDummyInformation()
00032 {
00033     return WPersonalInformation();
00034 }
00035 
00036 WPersonalInformation::WPersonalInformation()
00037     : m_subjectID( WSubject::SUBJECT_UNKNOWN ),
00038       m_subjectCode( "" ),
00039       m_lastName( "UNKNOWN" ),
00040       m_middleName( "" ),
00041       m_firstName( "" ),
00042       m_dateOfBirth( boost::date_time::not_a_date_time ),
00043       m_streetAndNumber( "" ),
00044       m_zipCode( "" ),
00045       m_city( "" ),
00046       m_state( "" ),
00047       m_country( "" ),
00048       m_phone( "" ),
00049       m_eMail( "" ),
00050       m_handicaps( "" ),
00051       m_sex( unknown ),
00052       m_categoryId( 0 ),
00053       m_handedness( "" ),
00054       m_notes( "" ),
00055       m_diagnostic( "" ),
00056       m_medication( "" ),
00057       m_referringDoctor( "" )
00058 {
00059 }
00060 
00061 uint64_t WPersonalInformation::getSubjectID() const
00062 {
00063     return m_subjectID;
00064 }
00065 
00066 void WPersonalInformation::setSubjectID( uint64_t subjectID )
00067 {
00068     WAssert( subjectID != WSubject::SUBJECT_UNKNOWN, "ID zero is reserved for dummies." );
00069     m_subjectID = subjectID;
00070 }
00071 
00072 std::string WPersonalInformation::getLastName() const
00073 {
00074     return m_lastName;
00075 }
00076 
00077 std::string WPersonalInformation::getCompleteName() const
00078 {
00079     return getLastName() + ", " + getFirstName() + " " + getMiddleName();
00080 }
00081 
00082 void WPersonalInformation::setLastName( std::string lastName )
00083 {
00084     WAssert( m_subjectID != WSubject::SUBJECT_UNKNOWN, "SubjectID is still zero. This is reserved for empty dummies. Set it first." );
00085     m_lastName = lastName;
00086 }
00087 
00088 std::string WPersonalInformation::getMiddleName() const
00089 {
00090     return m_middleName;
00091 }
00092 
00093 std::string WPersonalInformation::getFirstName() const
00094 {
00095     return m_firstName;
00096 }
00097 
00098 bool WPersonalInformation::operator==( WPersonalInformation info ) const
00099 {
00100     return m_subjectID  == info.m_subjectID
00101         && m_subjectCode == info.m_subjectCode
00102         && m_lastName == info.m_lastName
00103         && m_middleName == info.m_middleName
00104         && m_firstName == info.m_firstName
00105         && m_dateOfBirth == info.m_dateOfBirth
00106         && m_streetAndNumber == info.m_streetAndNumber
00107         && m_zipCode == info.m_zipCode
00108         && m_city == info.m_city
00109         && m_state == info.m_state
00110         && m_country == info.m_country
00111         && m_phone == info.m_phone
00112         && m_eMail == info.m_eMail
00113         && m_handicaps == info.m_handicaps
00114         && m_sex == info.m_sex
00115         && m_categoryId == info.m_categoryId
00116         && m_handedness == info.m_handedness
00117         && m_notes == info.m_notes
00118         && m_diagnostic == info.m_diagnostic
00119         && m_medication == info.m_medication
00120         && m_referringDoctor == info.m_referringDoctor;
00121 }
00122 
00123 bool WPersonalInformation::operator!=( WPersonalInformation info ) const
00124 {
00125     return !( (*this) == info );
00126 }