Files
Work/aladin/hold/profiledata.hpp
2024-08-07 09:12:07 -04:00

97 lines
2.2 KiB
C++

#ifndef _ALADIN_PROFILEDATA_HPP_
#define _ALADIN_PROFILEDATA_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
class ProfileData
{
public:
typedef enum Warning{TransmitErrorAirPressure=0x20,WorkTooHard=0x10,CeilingViolationOfDeco=0x08,AscentTooFast=0x04,RemainingBottomTimeTooShort=0x02,DecoStop=0x01,None=0};
ProfileData(void);
ProfileData(int depth,int stageTime,int warning);
virtual ~ProfileData();
int getDepth(void)const;
void setDepth(int depth);
int getStageTime(void)const;
void setStageTime(int stageTime);
Warning getWarning(void)const;
String getWarningString(void)const;
void setWarning(Warning warning);
private:
int mDepth;
int mStageTime;
int mWarning;
};
inline
ProfileData::ProfileData()
: mDepth(0), mStageTime(0), mWarning(None)
{
}
inline
ProfileData::ProfileData(int depth,int stageTime,int warning)
: mDepth(depth), mStageTime(stageTime), mWarning(warning)
{
}
inline
ProfileData::~ProfileData()
{
}
inline
int ProfileData::getDepth(void)const
{
return mDepth;
}
inline
void ProfileData::setDepth(int depth)
{
mDepth=depth;
}
inline
int ProfileData::getStageTime(void)const
{
return mStageTime;
}
inline
void ProfileData::setStageTime(int stageTime)
{
mStageTime=stageTime;
}
inline
ProfileData::Warning ProfileData::getWarning(void)const
{
return (Warning)mWarning;
}
inline
String ProfileData::getWarningString(void)const
{
String strWarning;
if(mWarning&TransmitErrorAirPressure)strWarning+="transmit error air pressure.";
if(mWarning&WorkTooHard){if(!strWarning.isNull())strWarning+=",";strWarning+="work too hard.";}
if(mWarning&CeilingViolationOfDeco){if(!strWarning.isNull())strWarning+=",";strWarning+="ceiling violation of deco.";}
if(mWarning&AscentTooFast){if(!strWarning.isNull())strWarning+=",";strWarning+="ascent too fast.";}
if(mWarning&RemainingBottomTimeTooShort){if(!strWarning.isNull())strWarning+=",";strWarning+="remaining bottom time too short.";}
if(mWarning&DecoStop){if(!strWarning.isNull())strWarning+=",";strWarning+="decompression stop.";}
if(!mWarning)strWarning+="no warnings";
return strWarning;
}
inline
void ProfileData::setWarning(Warning warning)
{
mWarning=warning;
}
#endif