Fire Core  8.0.0.alpha
GIS framework per tutti gli usi
 Tutto Classi Namespace Funzioni Variabili Ridefinizioni di tipo (typedef) Tipi enumerati (enum) Valori del tipo enumerato Friend
DateTimeSh.hpp
1 // Copyright © 2015 GEOSYSTEMS SRL
2 // All Rights Reserved.
3 
4 #ifndef FIRE_PLUGIN_DATA_SHARED_DATETIMESH_HPP_INCLUDED
5 #define FIRE_PLUGIN_DATA_SHARED_DATETIMESH_HPP_INCLUDED
6 
7 #include <boost/shared_ptr.hpp>
8 
9 #include <string>
10 #include <exception>
11 
12 #include "fire/gis/export.hpp"
13 #include "fire/shared/Shared.hpp"
14 #include "fire/source/vector/DateTime.hpp"
15 
16 namespace fire {
17 namespace source {
18 namespace vector {
19 namespace shared {
20 
21 class FIRE_GIS_DLL DateTimeSh: public fire::shared::Shared< DateTime > {
22  public:
23  DateTimeSh(): Shared(NULL) {
24  DateTime* dt = new DateTime();
25  _ptr.reset(dt);
26  }
27 
28  explicit DateTimeSh(DateTime* ptr): Shared(ptr) {
29  }
30 
31  explicit DateTimeSh(DateTime const & dt): Shared(NULL) {
32  DateTime* dtPtr = new DateTime(dt.getTime());
33  _ptr.reset(dtPtr);
34  }
35 
36  DateTimeSh(DateTimeSh const & c) {
37  this->operator =(c);
38  }
39 
40  long long getTime() const {
41  return _getPtr()->getTime();
42  }
43 
44  void setTime(double const & time) {
45  _getPtr()->setTime(time);
46  }
47 
48  std::string format(std::string const & pattern = "yyyy-MM-dd hh:mm:ss") const {
49  return _getPtr()->format(pattern);
50  }
51 
52  void parse(const std::string &txt, std::string const & pattern = "yyyy-MM-dd hh:mm:ss") {
53  _getPtr()->parse(txt, pattern);
54  }
55 };
56 
57 } // namespace shared
58 } // namespace vector
59 } // namespace source
60 } // namespace fire
61 
62 #endif
long long getTime() const
Definition: Shared.hpp:17
Definition: DateTimeSh.hpp:21
Definition: DateTime.hpp:25