Home | History | Annotate | Download | only in src
      1 /*
      2 INTEL CONFIDENTIAL
      3 Copyright 2009 Intel Corporation All Rights Reserved.
      4 The source code contained or described herein and all documents related to the source code ("Material") are owned by Intel Corporation or its suppliers or licensors. Title to the Material remains with Intel Corporation or its suppliers and licensors. The Material contains trade secrets and proprietary and confidential information of Intel or its suppliers and licensors. The Material is protected by worldwide copyright and trade secret laws and treaty provisions. No part of the Material may be used, copied, reproduced, modified, published, uploaded, posted, transmitted, distributed, or disclosed in any way without Intels prior express written permission.
      5 
      6 No license under any patent, copyright, trade secret or other intellectual property right is granted to or conferred upon you by disclosure or delivery of the Materials, either expressly, by implication, inducement, estoppel or otherwise. Any license under such intellectual property rights must be express and approved by Intel in writing.
      7 */
      8 
      9 #ifndef __MIX_DISPLAY_H__
     10 #define __MIX_DISPLAY_H__
     11 
     12 #include <glib-object.h>
     13 
     14 G_BEGIN_DECLS
     15 #define MIX_TYPE_DISPLAY          (mix_display_get_type())
     16 #define MIX_IS_DISPLAY(obj)       (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIX_TYPE_DISPLAY))
     17 #define MIX_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MIX_TYPE_DISPLAY))
     18 #define MIX_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MIX_TYPE_DISPLAY, MixDisplayClass))
     19 #define MIX_DISPLAY(obj)          (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIX_TYPE_DISPLAY, MixDisplay))
     20 #define MIX_DISPLAY_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST ((klass), MIX_TYPE_DISPLAY, MixDisplayClass))
     21 #define MIX_DISPLAY_CAST(obj)     ((MixDisplay*)(obj))
     22 typedef struct _MixDisplay MixDisplay;
     23 typedef struct _MixDisplayClass MixDisplayClass;
     24 
     25 /**
     26 * MixDisplayDupFunction:
     27 * @obj: Display to duplicate
     28 * @returns: reference to cloned instance.
     29 *
     30 * Virtual function prototype for methods to create duplicate of instance.
     31 *
     32 */
     33 typedef MixDisplay *(*MixDisplayDupFunction) (const MixDisplay * obj);
     34 
     35 /**
     36 * MixDisplayCopyFunction:
     37 * @target: target of the copy
     38 * @src: source of the copy
     39 * @returns: boolean indicates if copy is successful.
     40 *
     41 * Virtual function prototype for methods to create copies of instance.
     42 *
     43 */
     44 typedef gboolean (*MixDisplayCopyFunction) (MixDisplay * target,
     45 					    const MixDisplay * src);
     46 
     47 /**
     48 * MixDisplayFinalizeFunction:
     49 * @obj: Display to finalize
     50 *
     51 * Virtual function prototype for methods to free ressources used by
     52 * object.
     53 */
     54 typedef void (*MixDisplayFinalizeFunction) (MixDisplay * obj);
     55 
     56 /**
     57 * MixDisplayEqualsFunction:
     58 * @first: first object in the comparison
     59 * @second: second object in the comparison
     60 *
     61 * Virtual function prototype for methods to compare 2 objects and check if they are equal.
     62 */
     63 typedef gboolean (*MixDisplayEqualFunction) (MixDisplay * first,
     64 					     MixDisplay * second);
     65 
     66 /**
     67 * MIX_VALUE_HOLDS_DISPLAY:
     68 * @value: the #GValue to check
     69 *
     70 * Checks if the given #GValue contains a #MIX_TYPE_PARAM value.
     71 */
     72 #define MIX_VALUE_HOLDS_DISPLAY(value)  (G_VALUE_HOLDS(value, MIX_TYPE_DISPLAY))
     73 
     74 /**
     75 * MIX_DISPLAY_REFCOUNT:
     76 * @obj: a #MixDisplay
     77 *
     78 * Get access to the reference count field of the object.
     79 */
     80 #define MIX_DISPLAY_REFCOUNT(obj)           ((MIX_DISPLAY_CAST(obj))->refcount)
     81 /**
     82 * MIX_DISPLAY_REFCOUNT_VALUE:
     83 * @obj: a #MixDisplay
     84 *
     85 * Get the reference count value of the object
     86 */
     87 #define MIX_DISPLAY_REFCOUNT_VALUE(obj)     (g_atomic_int_get (&(MIX_DISPLAY_CAST(obj))->refcount))
     88 
     89 /**
     90 * MixDisplay:
     91 * @instance: type instance
     92 * @refcount: atomic refcount
     93 *
     94 * Base class for a refcounted parameter objects.
     95 */
     96 struct _MixDisplay
     97 {
     98   GTypeInstance instance;
     99   /*< public > */
    100   gint refcount;
    101 
    102   /*< private > */
    103   gpointer _reserved;
    104 };
    105 
    106 /**
    107 * MixDisplayClass:
    108 * @dup: method to duplicate the object.
    109 * @copy: method to copy details in one object to the other.
    110 * @finalize: destructor
    111 * @equal: method to check if the content of two objects are equal.
    112 *
    113 * #MixDisplay class strcut.
    114 */
    115 struct _MixDisplayClass
    116 {
    117   GTypeClass type_class;
    118 
    119   MixDisplayDupFunction dup;
    120   MixDisplayCopyFunction copy;
    121   MixDisplayFinalizeFunction finalize;
    122   MixDisplayEqualFunction equal;
    123 
    124   /*< private > */
    125   gpointer _mix_reserved;
    126 };
    127 
    128 /**
    129 * mix_display_get_type:
    130 * @returns: type of this object.
    131 *
    132 * Get type.
    133 */
    134 GType mix_display_get_type (void);
    135 
    136 /**
    137 * mix_display_new:
    138 * @returns: return a newly allocated object.
    139 *
    140 * Create new instance of the object.
    141 */
    142 MixDisplay *mix_display_new ();
    143 
    144 /**
    145 * mix_display_copy:
    146 * @target: copy to target
    147 * @src: copy from source
    148 * @returns: boolean indicating if copy is successful.
    149 *
    150 * Copy data from one instance to the other. This method internally invoked the #MixDisplay::copy method such that derived object will be copied correctly.
    151 */
    152 gboolean mix_display_copy (MixDisplay * target, const MixDisplay * src);
    153 
    154 /**
    155 * mix_display_ref:
    156 * @obj: a #MixDisplay object.
    157 * @returns: the object with reference count incremented.
    158 *
    159 * Increment reference count.
    160 */
    161 MixDisplay *mix_display_ref (MixDisplay * obj);
    162 
    163 /**
    164 * mix_display_unref:
    165 * @obj: a #MixDisplay object.
    166 *
    167 * Decrement reference count.
    168 */
    169 void mix_display_unref (MixDisplay * obj);
    170 
    171 /**
    172 * mix_display_replace:
    173 * @olddata:
    174 * @newdata:
    175 *
    176 * Replace a pointer of the object with the new one.
    177 */
    178 void mix_display_replace (MixDisplay ** olddata, MixDisplay * newdata);
    179 
    180 /**
    181 * mix_display_dup:
    182 * @obj: #MixDisplay object to duplicate.
    183 * @returns: A newly allocated duplicate of the object, or NULL if failed.
    184 *
    185 * Duplicate the given #MixDisplay and allocate a new instance. This method is chained up properly and derive object will be dupped properly.
    186 */
    187 MixDisplay *mix_display_dup (const MixDisplay * obj);
    188 
    189 /**
    190 * mix_display_equal:
    191 * @first: first object to compare
    192 * @second: second object to compare
    193 * @returns: boolean indicates if the 2 object contains same data.
    194 *
    195 * Note that the parameter comparison compares the values that are hold inside the object, not for checking if the 2 pointers are of the same instance.
    196 */
    197 gboolean mix_display_equal (MixDisplay * first, MixDisplay * second);
    198 
    199 /* GParamSpec */
    200 
    201 #define MIX_TYPE_PARAM_DISPLAY (mix_param_spec_display_get_type())
    202 #define MIX_IS_PARAM_SPEC_DISPLAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), MIX_TYPE_PARAM_DISPLAY))
    203 #define MIX_PARAM_SPEC_DISPLAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), MIX_TYPE_PARAM_DISPLAY, MixParamSpecDisplay))
    204 
    205 typedef struct _MixParamSpecDisplay MixParamSpecDisplay;
    206 
    207 /**
    208 * MixParamSpecDisplay:
    209 * @parent: #GParamSpec portion
    210 *
    211 * A #GParamSpec derived structure that contains the meta data
    212 * for #MixDisplay properties.
    213 */
    214 struct _MixParamSpecDisplay
    215 {
    216   GParamSpec parent;
    217 };
    218 
    219 GType mix_param_spec_display_get_type (void);
    220 
    221 GParamSpec *mix_param_spec_display (const char *name, const char *nick,
    222 				    const char *blurb, GType object_type,
    223 				    GParamFlags flags);
    224 
    225 /* GValue methods */
    226 
    227 void mix_value_set_display (GValue * value, MixDisplay * obj);
    228 void mix_value_take_display (GValue * value, MixDisplay * obj);
    229 MixDisplay *mix_value_get_display (const GValue * value);
    230 MixDisplay *mix_value_dup_display (const GValue * value);
    231 
    232 G_END_DECLS
    233 #endif
    234