Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.2.1.4.0)

E90870-01

coherence/io/pof/RawDateTime.hpp

00001 /*
00002 * RawDateTime.hpp
00003 *
00004 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
00005 *
00006 * Oracle is a registered trademarks of Oracle Corporation and/or its
00007 * affiliates.
00008 *
00009 * This software is the confidential and proprietary information of Oracle
00010 * Corporation. You shall not disclose such confidential and proprietary
00011 * information and shall use it only in accordance with the terms of the
00012 * license agreement you entered into with Oracle.
00013 *
00014 * This notice may not be removed or altered.
00015 */
00016 #ifndef COH_RAW_DATE_TIME_HPP
00017 #define COH_RAW_DATE_TIME_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/io/pof/PofIntrinsic.hpp"
00022 #include "coherence/io/pof/RawDate.hpp"
00023 #include "coherence/io/pof/RawTime.hpp"
00024 
00025 
00026 #include <time.h>
00027 
00028 COH_OPEN_NAMESPACE3(coherence,io,pof)
00029 
00030 
00031 /**
00032 * Raw immutable POF date-time value.
00033 *
00034 * @author jh  2008.04.08
00035 */
00036 class COH_EXPORT RawDateTime
00037     : public cloneable_spec<RawDateTime,
00038           extends<Object>,
00039           implements<PofIntrinsic> >
00040     {
00041     friend class factory<RawDateTime>;
00042 
00043     // ----- typedefs -------------------------------------------------------
00044 
00045     public:
00046         /**
00047         * The boxed native type.
00048         */
00049         typedef struct tm BoxedType;
00050 
00051 
00052     // ----- constructors ---------------------------------------------------
00053 
00054     protected:
00055         /**
00056         * Construct a date-time value.
00057         *
00058         * @param vDate  the date portion of the raw date-time value
00059         * @param vTime  the time portion of the raw date-time value
00060         *
00061         * @return the new RawDateTime
00062         */
00063         RawDateTime(RawDate::View vDate, RawTime::View vTime);
00064 
00065         /**
00066         * Construct a raw POF datetime value from a POSIX datetime struct.
00067         *
00068         * Note that the POSIX daylight savings flag is not preserved.
00069         *
00070         * @param timeinfo  the POSIX datetime
00071         * @param fUTC      true if the time value is UTC or false if the time
00072         *                  value does not have an explicit time zone
00073         *
00074         */
00075         RawDateTime(const struct tm& timeinfo, bool fUTC = false);
00076 
00077         /**
00078         * Copy constructor.
00079         */
00080         RawDateTime(const RawDateTime& that);
00081 
00082 
00083     // ----- Object interface -----------------------------------------------
00084 
00085     public:
00086         /**
00087         * {@inheritDoc}
00088         */
00089         virtual bool equals(Object::View v) const;
00090 
00091         /**
00092         * {@inheritDoc}
00093         */
00094         virtual size32_t hashCode() const;
00095 
00096         /**
00097         * {@inheritDoc}
00098         */
00099         virtual bool isImmutable() const;
00100 
00101         /**
00102         * {@inheritDoc}
00103         */
00104         virtual TypedHandle<const String> toString() const;
00105 
00106 
00107     // ----- accessors ------------------------------------------------------
00108 
00109     public:
00110         /**
00111         * Obtain the date portion of the raw date-time value.
00112         *
00113         * @return the date portion of the raw date-time value
00114         */
00115         virtual RawDate::View getRawDate() const;
00116 
00117         /**
00118         * Obtain the time portion of the raw date-time value.
00119         *
00120         * @return the time portion of the raw date-time value
00121         */
00122         virtual RawTime::View getRawTime() const;
00123 
00124         /**
00125         * Convert the RawDateTime to a POSIX datetime struct.
00126         *
00127         * Note that RawTime's nanosecond and timezone related information are
00128         * not preserved.
00129         */
00130         virtual operator struct tm() const;
00131 
00132 
00133     // ----- data members ---------------------------------------------------
00134 
00135     protected:
00136         /**
00137         * The date portion of the raw date-time value.
00138         */
00139         FinalView<RawDate> f_vDate;
00140 
00141         /**
00142         * The time portion of the raw date-time value.
00143         */
00144         FinalView<RawTime> f_vTime;
00145     };
00146 
00147 COH_CLOSE_NAMESPACE3
00148 
00149 #endif // COH_RAW_DATE_TIME_HPP
Copyright © 2000, 2019, Oracle and/or its affiliates. All rights reserved.