GPSTK日志五 TimeTag
来源:互联网 发布:山东省卫生网络直报 编辑:程序博客网 时间:2024/06/06 01:50
看完 commontime 的定义又回过头来看了下 TimeTag 这个类,这是一个具体时间系统的基类,所以楼主觉得有必要仔细的介绍下里面的方法。注意 commontime 并不是 TimeTag 的子类,之所以要先介绍它,应为它是所有时间系统转转的一个中间过程。转换的实现由 TimeTag 的虚函数定义的以下两个方法完成:
virtual CommonTime convertToCommonTime() const
throw( gpstk::InvalidRequest ) = 0; //对应时间系统转换为CommonTime
virtual void convertFromCommonTime( const CommonTime& ct )
throw( gpstk::InvalidRequest ) = 0; // CommonTime 转换为对应时间系统
这里顺道对上面函数的几个基本语法注明下吧, 函数后面的 const 意味着函数返回值是不可修改的,throw 表示该函数跑出的异常,
func() throw(type) ,会抛出某种异常
func() throw(),不会抛出
func() throw(...),可能是任何类型的异常
函数后面 = 0;表示这是一个纯虚函数,没有具体的函数体,只有一个函数声名,函数体留给它的派生类来实现,而且,这个类的派生类必须重载全部纯虚函数(重载的时候不能指定为纯虚)。 可以理解为表示将这个函数指针设置为0。
两个纯虚打印函数,
virtual std::string printf( const std::string& fmt ) const throw( gpstk::StringUtils::StringException ) = 0;
virtual std::string printError( const std::string& fmt ) const throw( gpstk::StringUtils::StringException ) = 0;
virtual void scanf( const std::string& str, const std::string& fmt )
throw( gpstk::InvalidRequest, gpstk::StringUtils::StringException ); // This function sets this object to the time stored in the given 这个具体的结合实例来说
typedef std::map< char, std::string> IdToValue; // 定义map容器
static void getInfo( const std::string& str, const std::string& fmt,IdToValue& info )
throw( gpstk::StringUtils::StringException ); //这个是 scanf 成员函数实现的具体方法,在sacnf中需要调用它
virtual bool setFromInfo( const IdToValue& info ) throw() = 0; // 将对象按 IdToValue 格式进行设置
virtual std::string getPrintChars() const throw() = 0; // 这个留在下一篇讲吧
virtual std::string getDefaultFormat() const throw() = 0; // 返回一个打印格式的字符串的
virtual bool isValid() const throw() = 0; // 检查对象的成员是否有效
virtual void reset() throw() = 0; // 将对象设置为默认值
{ return printf( getDefaultFormat() ); }
/// Hey, it's an implicit casting operator! Basically just a lazy
/// way to get at convertToCommonTime().
virtual operator CommonTime() const throw(InvalidRequest) { return convertToCommonTime(); } //看下原文注释这个没什么好说的
/// This returns the regular expression prefix that is used when
/// searching for integer specifiers.
static inline std::string getFormatPrefixInt()
{ return "%[ 0-]?[[:digit:]]*"; }
/// This returns the regular expression prefix that is used when
/// searching for float specifiers.
static inline std::string getFormatPrefixFloat()
{ return getFormatPrefixInt() + "(\\.[[:digit:]]+)?"; } // 以上两个均与正则表达式有关
static inline std::string getError() //返回一个默认错误信息
{ return "ErrorBadTime"; }
- GPSTK日志五 TimeTag
- GPSTK日志1 简介
- GPSTK日志四 通用时
- GPSTK日志三 TK的安装
- GPSTK日志二 支持格式文件的一些整理
- GPSTK 数据配置文件格式
- 实习日志(五)
- 实习日志(五)
- 备忘日志【五】
- java学习日志五
- 五周工作日志
- 框架(五)日志
- GPSTK 自己写一个jam目录
- 关于gpstk空间名封装的问题
- NDS开发日志(五)
- 三月五日工作日志
- bjrcb-日志汇总(五)
- QHBANK-日志汇总(五)
- 2013暑假集训B组训练赛第一场
- Ubunt下安装postgresql
- Code Fragment-Android在其他线程可以使用方法在UI线程执行UI相关
- nbutoj1475
- 自定义ContentProvider
- GPSTK日志五 TimeTag
- 怎样成为一个黑客(翻译自wikihow上的一篇文章)
- 写博客的重要性
- Android 应用中TCP 初步探索?
- Android开发者必知的开发资源
- SSDT结构简记
- Ubuntu软件安装与卸载
- poj 3345 Bribing FIPA[树形dp+背包]
- C#调用存储过程操作oracle数据库中的表