rllib  1
rlopcxmlda.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                           rlopcxmlda.h  -  description
00003                              -------------------
00004     begin                : Mon Aug 27 2007
00005     copyright            : (C) 2007 by pvbrowser
00006     email                : lehrig@t-online.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as        *
00013  *   published by the Free Software Foundation                             *
00014  *                                                                         *
00015  ***************************************************************************/
00022 #ifndef _RL_OPC_XML_DA_H_
00023 #define _RL_OPC_XML_DA_H_
00024 
00025 #include "rldefine.h"
00026 #include "rlmailbox.h"
00027 #include "rlsharedmemory.h"
00028 
00033 class rlOpcXmlDa
00034 {
00035 public:
00036   // shared memory header
00037   typedef struct
00038   {
00039     char ident[4];          // must be "opc"
00040     int  maxItemNameLength; // maximum length of an item name
00041     int  maxNameLength;     // maximum length of the item value
00042     int  numItems;          // number of items in shared memory
00043     int  readErrorCount;    // 0...65536 incremented by each read error
00044     int  writeErrorCount;   // 0...65536 incremented by each write error
00045     int  spare[8];          // for future use
00046     char cspare[32];        // for future use
00047   }SHM_HEADER;
00048   
00049   enum OPC_XML_DA_ENUM
00050   {
00051     OPCXMLDA_ERROR = 256*256*128
00052   };
00053 
00054 #ifdef RLWIN32  
00055   rlOpcXmlDa(const char *mailbox="c:\\automation\\mbx\\opcxmlda.mbx", const char *shared_memory="c:\\automation\\shm\\opcxmlda.shm", long shared_memory_size=65536);
00056 #else
00057   rlOpcXmlDa(const char *mailbox="/srv/automation/mbx/opcxmlda.mbx", const char *shared_memory="/srv/automation/shm/opcxmlda.shm", long shared_memory_size=65536);
00058 #endif
00059   virtual    ~rlOpcXmlDa();
00060   const char *stringValue(const char *variable);
00061   int         intValue(const char *variable);
00062   float       floatValue(const char *variable);
00063   int         writeStringValue(const char *variable, const char *value);
00064   int         writeIntValue(const char *variable, int value);
00065   int         writeFloatValue(const char *variable, float value);
00066   int         readErrorCount();
00067   int         writeErrorCount();
00068   int         shmStatus(); // 0 if shared memory is ok | ERROR if shared memory is not ok
00069 
00070 private:
00071   SHM_HEADER     *shmheader;
00072   const char     *shmvalues;
00073   rlMailbox      *mbx;
00074   rlSharedMemory *shm;
00075 };
00076 
00077 #endif
00078