Topic
  • 2 replies
  • Latest Post - ‏2013-02-04T08:12:11Z by Saruton
Saruton
Saruton
111 Posts

Pinned topic How should I specify TimestampFormat enum in C++ primitive operator?

‏2013-02-01T02:55:54Z |
Hi ALL,
I'd like to call toTimestamp (const Enum &type, const SPL::rstring &str) in C++ primitive operator, but I can't find the way to specify TimestampFormat enum as the 1st parameter.
I could call counterpart SPL function toTimestamp( Sys.YYYY_MM_DD_hh_mm_ss, sTime ) like this:


myTime = toTimestamp( Sys.YYYY_MM_DD_hh_mm_ss, sTime );


I tried several ways (the following is one of them), but they cause compile errors.


using namespace SPL::Functions::Time;
myTime = toTimestamp( SPL::Functions::Time::YYYY_MM_DD_hh_mm_ss, timeString );


Thenks in advance.
  • hnasgaard
    hnasgaard
    200 Posts

    Re: How should I specify TimestampFormat enum in C++ primitive operator?

    ‏2013-02-01T13:06:56Z  
    Calling that version of toTimestamp from C++ primitive operators isn't supported. The problem is, that function takes a ref to a Enum, and you don't have an Enum to pass it. When using this from SPL code the Enum code is generated in response to its use. It doesn't exist anywhere else other than in the operator that uses it. If you write a small SPL example that uses that enum, you can see the generated code in output/src/type.
  • Saruton
    Saruton
    111 Posts

    Re: How should I specify TimestampFormat enum in C++ primitive operator?

    ‏2013-02-04T08:12:11Z  
    • hnasgaard
    • ‏2013-02-01T13:06:56Z
    Calling that version of toTimestamp from C++ primitive operators isn't supported. The problem is, that function takes a ref to a Enum, and you don't have an Enum to pass it. When using this from SPL code the Enum code is generated in response to its use. It doesn't exist anywhere else other than in the operator that uses it. If you write a small SPL example that uses that enum, you can see the generated code in output/src/type.
    Thanks for reply.
    I understood the situation. The easiest way is add Functor or Custom which calls toTimestamp() and converts date/time string attribute to timestamp type. I think.

    Thanks a lot!