Changeset 22:6c70706c690b in rrlib_util


Ignore:
Timestamp:
11.03.2011 07:57:55 (9 years ago)
Author:
Max Reichardt <reichardt@…>
Branch:
default
Phase:
public
Convert:
svn:dcce5f72-5200-4218-9373-75d9081937af/trunk@29
Message:

Added optional serialization for tTime

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tTime.cpp

    r20 r22  
    2525//---------------------------------------------------------------------- 
    2626#include "rrlib/util/tTime.h" 
     27 
     28#ifdef _LIB_RRLIB_SERIALIZATION_PRESENT_ 
     29#include "rrlib/serialization/tInputStream.h" 
     30#include "rrlib/serialization/tOutputStream.h" 
     31 
     32rrlib::serialization::tOutputStream &rrlib::util::operator << (rrlib::serialization::tOutputStream &stream, const rrlib::util::tTime &t) 
     33{ 
     34  stream << t.TvSec() << t.TvUSec(); 
     35  return stream; 
     36} 
     37 
     38rrlib::serialization::tInputStream &rrlib::util::operator >> (rrlib::serialization::tInputStream &stream, rrlib::util::tTime &t) 
     39{ 
     40  long s, us; 
     41  stream >> s >> us; 
     42  t.SetTvSec(s); 
     43  t.SetTvUSec(us); 
     44  return stream; 
     45} 
     46 
     47#endif 
    2748 
    2849using rrlib::util::tTime; 
     
    5677const tTime tTime::time_30000s(30000, 0); 
    5778const tTime tTime::time_1year(365 * 86400, 0); 
     79 
  • tTime.h

    r20 r22  
    3232namespace rrlib 
    3333{ 
     34 
     35#ifdef _LIB_RRLIB_SERIALIZATION_PRESENT_ 
     36namespace serialization 
     37{ 
     38class tInputStream; 
     39class tOutputStream; 
     40} 
     41#endif 
     42 
    3443namespace util 
    3544{ 
     
    450459  return str; 
    451460} 
     461 
     462#ifdef _LIB_RRLIB_SERIALIZATION_PRESENT_ 
     463 
     464serialization::tOutputStream &operator << (serialization::tOutputStream &stream, const tTime &t); 
     465 
     466serialization::tInputStream &operator >> (serialization::tInputStream &stream, tTime &t); 
     467 
     468#endif 
     469 
    452470} 
    453471} 
Note: See TracChangeset for help on using the changeset viewer.