IDatum.h

Go to the documentation of this file.
00001 /*========================================================== */ 
00002 // header file automatically generated by PIDGEN - DO NOT MODIFY
00003 /*========================================================== */ 
00004 
00005 #ifndef SUPPORT_IDATUM_H
00006 #define SUPPORT_IDATUM_H
00007 
00008 #include <support/IInterface.h>
00009 #include <support/Binder.h>
00010 #include <support/Context.h>
00011 #include <support/String.h>
00012 
00013 /*
00014  * Copyright (c) 2005 Palmsource, Inc.
00015  * 
00016  * This software is licensed as described in the file LICENSE, which
00017  * you should have received as part of this distribution. The terms
00018  * are also available at http://www.openbinder.org/license.html.
00019  * 
00020  * This software consists of voluntary contributions made by many
00021  * individuals. For the exact contribution history, see the revision
00022  * history and logs, available at http://www.openbinder.org
00023  */
00042 /* ============= Interface Class Declarations =========================== */
00043 
00044 #if _SUPPORTS_NAMESPACE
00045 namespace palmos {
00046 namespace support {
00047 #endif /* _SUPPORTS_NAMESPACE */
00048 
00050 
00083 class IDatum : public IInterface
00084 {
00085 public:
00086     B_DECLARE_META_INTERFACE(Datum)
00087     
00088     
00089     /* ------- enums/structs --------------------- */
00090     enum  {
00092         READ_ONLY=0x0000,
00094         WRITE_ONLY=0x0001,
00096         READ_WRITE=0x0002,
00098         READ_WRITE_MASK=0x0003,
00100         ERASE_DATUM=0x0200,
00102         OPEN_AT_END=0x0400
00103     };
00104     
00105     enum  {
00107 
00114         NO_COPY_REDIRECTION=0x0001
00115     };
00116     
00117     
00118     /* ------- Properties --------------------- */
00119     
00121     virtual uint32_t                ValueType() const = 0;
00123     virtual void                    SetValueType(uint32_t value) = 0;
00124     
00126     virtual off_t                   Size() const = 0;
00128     virtual void                    SetSize(off_t value) = 0;
00129     
00131 
00138     virtual SValue                  Value() const = 0;
00140 
00147     virtual void                    SetValue(const SValue& value) = 0;
00148     
00149     /* ------- Methods ------------------------ */
00150     
00152 
00170     virtual sptr<IBinder>           Open(uint32_t mode, const sptr<IBinder>& editor = NULL, uint32_t newType = 0) = 0;
00171     
00173 
00178     virtual status_t                CopyTo(const sptr<IDatum>& dest, uint32_t flags = 0) = 0;
00179     
00181 
00186     virtual status_t                CopyFrom(const sptr<IDatum>& src, uint32_t flags = 0) = 0;
00187     
00188     /* ------- Events ------------------------ */
00189     
00194     /* ------- inline helpers ------------------------- */
00195     status_t LinkDatum(const sptr<IBinder>& to, const SValue& mappings, uint32_t flags = 0)
00196     {
00197         return AsBinder()->Link(to, mappings, flags);
00198     }
00199     status_t UnlinkDatum(const sptr<IBinder>& to, const SValue& mappings, uint32_t flags = 0)
00200     {
00201         return AsBinder()->Unlink(to, mappings, flags);
00202     }
00203 
00204 protected:
00205                                     IDatum() { }
00206     virtual                         ~IDatum();
00207 
00208 private:
00209     /* ------- copy/assignment protection ------------------ */
00210                                     IDatum(const IDatum& o);
00211             IDatum&                 operator=(const IDatum& o);
00212 };
00213 
00214 
00215 /* ============= Local Class Declarations =============================== */
00216 
00217 class BnDatum : public IDatum, public BBinder
00218 {
00219 public:
00220     virtual SValue                  Inspect(const sptr<IBinder>& caller, const SValue& which, uint32_t flags = 0);
00221     virtual sptr<IInterface>        InterfaceFor(const SValue& descriptor, uint32_t flags = 0);
00222     
00223     /* ------- Events ------------------------- */
00224 public:
00226 
00235             void                    PushDatumChanged(const sptr<IDatum>& who, const sptr<IBinder>& editor, off_t start, off_t length);
00236     
00237     /* ------- Push Properties ---------------- */
00238 public:
00239             void                    PushValueType(uint32_t value);
00240             void                    PushSize(off_t value);
00241             void                    PushValue(const SValue& value);
00242 
00243 protected:
00244                                     BnDatum();
00245                                     BnDatum(const SContext& context);
00246     virtual                         ~BnDatum();
00247     
00248     virtual sptr<IBinder>           AsBinderImpl();
00249     virtual sptr<const IBinder>     AsBinderImpl() const;
00250     
00251     /* ------- Marshalling Details ------------ */
00252     virtual status_t                HandleEffect(const SValue &, const SValue &, const SValue &, SValue *);
00253     virtual status_t                Transact(uint32_t code, SParcel& data, SParcel* reply, uint32_t flags);
00254 
00255 private:
00256                                     BnDatum(const BnDatum& o);
00257             BnDatum&                operator=(const BnDatum& o);
00258 };
00259 
00260 
00261 #if _SUPPORTS_NAMESPACE
00262 } } // namespace palmos::support
00263 #endif /* _SUPPORTS_NAMESPACE */
00264 
00265 
00266 // namespace palmos::support
00267 
00268 #endif // SUPPORT_IDATUM_H
00269