Paul Paterson / ppCANOpen

Dependents:   ppCANOpen_Example DISCO-F746NG_rtos_test

Revision:
5:22a337cdc0e3
Parent:
4:2034b04c86d2
diff -r 2034b04c86d2 -r 22a337cdc0e3 include/ObjectDictionary.h
--- a/include/ObjectDictionary.h	Sat Jan 09 17:15:29 2016 +0000
+++ b/include/ObjectDictionary.h	Sat Feb 13 20:22:59 2016 +0000
@@ -34,27 +34,21 @@
 namespace ppCANOpen
 {
 
-/** Abstract Object Dictionary class to provide constants and virtual scan
-  * function.
-  */
-class ObjectDictionary
+/** Data Type alias to provide context when defining the object library */
+typedef uint8_t DataType;
+
+/** Data Property alias to provide context when defining the object library */
+typedef uint8_t DataProperty;
+
+/** defines the data in a single entry of data (subindex)
+ */
+struct EntryData
 {
-    
-public:
-
-    /*=========================================================================
-     * Constants wrapped into the Object Dictionary to use with construction
-     *=========================================================================
-     */
-     
     /* Data value type constants ----------------------------------------------
      * Taken from the CANOpen Standard.  they are part of the object dictionary
      * at indices 0x0001 to 0x0023.  Given to every Sub Index.
      */
      
-    /** Data Type alias to provide context when defining the object library */
-    typedef uint8_t DataType;
-     
     static const DataType TYPE_BOOLEAN                     = 0x01;
     static const DataType TYPE_INT8                        = 0x02;
     static const DataType TYPE_INT16                       = 0x03;
@@ -94,69 +88,46 @@
      * Can be strung together into a mask.
      */
      
-    /** Data Property alias to provide context when defining the object library */
-    typedef uint8_t DataProperty;
-    
     static const DataProperty PROPERTY_READABLE         = 0x01;
     static const DataProperty PROPERTY_WRITEABLE        = 0x02;
     static const DataProperty PROPERTY_READ_WRITEABLE   = 0x03;
     /* static const uint8_t PROPERTY_STATIC                = 0x04 *//* possible to save setting after powerdown */
     
-    
-    /* Index Constants --------------------------------------------------------
+    /* EntryData data --------------------------------------------------------
      */
-     
-    /** Index alias to provide context when defining the object library */
-    typedef uint8_t Index;
+    
+    void           *pData;
+    uint16_t        size;
+    DataType        type;
+    DataProperty    properties;
+    
+    EntryData(){}
+    
+    EntryData(void *d, uint16_t s, DataType t, DataProperty p)
+    : pData(d), size(s), type(t), properties(p)
+    {}
+};
 
 
-    /*=========================================================================
-     * Internal structures
-     *=========================================================================
-     */
-     
-    /** defines the data in a single entry of data (subindex)
-     */
-    struct EntryData
-    {           
-        void           *pData;
-        uint16_t        size;
-        DataType        type;
-        DataProperty    properties;
-        
-        EntryData(){}
-        
-        EntryData(void *d, uint16_t s, DataType t, DataProperty p)
-        : pData(d), size(s), type(t), properties(p)
-        {}
-    };
+/** Index alias to provide context when defining the object library */
+typedef uint16_t IndexSize;
+
+/** Sub-Index alias to provide context when defining the object library */
+typedef uint8_t SubIndexSize;
+
+/** defines the data for a single index, including an array of subindices
+ */
+struct ObjectData
+{                
+    EntryData       *entries;
+    IndexSize        index;
+    SubIndexSize     entryCount;
     
-    /** defines the data for a single index, including an array of subindices
-     */
-    struct ObjectData
-    {        
-        EntryData  *entries;
-        uint16_t    index;
-        uint16_t    entryCount;
-        
-        ObjectData(){}
-        
-        ObjectData(EntryData *e, uint16_t i, uint16_t c)
-        : entries(e), index(i), entryCount(c)
-        {}
-    };
-
-
-    /*=========================================================================
-     * Public Methods
-     *=========================================================================
-     */
-     
-    /** Abstract method to give access to the object entries of derived
-      * classes
-      */
-    virtual ObjectData * ScanIndex(int index) = 0;
+    ObjectData(){}
     
+    ObjectData(EntryData *e, IndexSize i, SubIndexSize c)
+    : entries(e), index(i), entryCount(c)
+    {}
 };
 
 } /* namespace ppCANOpen */