ProcessViewBrowser-ServerProgramming
Public Member Functions | Private Member Functions | Private Attributes
pvWidgetIdManager Class Reference

#include <processviewserver.h>

Public Member Functions

 pvWidgetIdManager ()
 
virtual ~pvWidgetIdManager ()
 
int init (PARAM *p, int id_start)
 
virtual int newId (const char *name)
 
virtual int deleteWidget (PARAM *p, const char *name)
 
virtual int id (const char *name)
 
virtual int isInMap (const char *name)
 
int isInMap (int id)
 
int firstId ()
 
int nextId ()
 
int endId ()
 
const char * name (int id)
 
int idStart ()
 
virtual int readEnumFromMask (const char *maskname)
 

Private Member Functions

int insertBasicId (int id, const char *name)
 

Private Attributes

int id_start
 
int num_additional_widgets
 
int * free
 
std::map< std::string, int > id_list
 
std::multimap< std::string, int >::iterator it
 

Detailed Description

Use this class for manageing p->num_additional_widgets by widget names
Example:
typedef struct // (todo: define your data structure here)
{
  pvWidgetIdManager mgr;
}
DATA;
static int slotInit(PARAM *p, DATA *d)
{
  if(p == NULL || d == NULL) return -1;
  int id;
  d->mgr.init(p,ID_END_OF_WIDGETS);
  id = d->mgr.newId("test1");
  pvQPushButton(p,id,0);
  pvSetGeometry(p,id,270,40,100,30);
  pvSetText(p,id,"test1");
  pvShow(p,id);
  return 0;
}                                                      }
static int slotButtonPressedEvent(PARAM *p, int id, DATA *d)
{
  if(p == NULL || id == 0 || d == NULL) return -1;
  if(id == obj1)
  {
    printf("knowns id's:\n");
    int i = d->mgr.first();
    while(i > 0)
    {
      printf("name=%s id=%d\n", d->mgr.name(i),i);
      i = d->mgr.next();
    }
  }
  return 0;
}
 

Constructor & Destructor Documentation

◆ pvWidgetIdManager()

pvWidgetIdManager::pvWidgetIdManager ( )

◆ ~pvWidgetIdManager()

virtual pvWidgetIdManager::~pvWidgetIdManager ( )
virtual

Member Function Documentation

◆ deleteWidget()

virtual int pvWidgetIdManager::deleteWidget ( PARAM p,
const char *  name 
)
virtual

◆ endId()

int pvWidgetIdManager::endId ( )

◆ firstId()

int pvWidgetIdManager::firstId ( )

◆ id()

virtual int pvWidgetIdManager::id ( const char *  name)
virtual

◆ idStart()

int pvWidgetIdManager::idStart ( )

◆ init()

int pvWidgetIdManager::init ( PARAM p,
int  id_start 
)

◆ insertBasicId()

int pvWidgetIdManager::insertBasicId ( int  id,
const char *  name 
)
private

◆ isInMap() [1/2]

virtual int pvWidgetIdManager::isInMap ( const char *  name)
virtual

◆ isInMap() [2/2]

int pvWidgetIdManager::isInMap ( int  id)

◆ name()

const char* pvWidgetIdManager::name ( int  id)

◆ newId()

virtual int pvWidgetIdManager::newId ( const char *  name)
virtual

◆ nextId()

int pvWidgetIdManager::nextId ( )

◆ readEnumFromMask()

virtual int pvWidgetIdManager::readEnumFromMask ( const char *  maskname)
virtual

Field Documentation

◆ free

int* pvWidgetIdManager::free
private

◆ id_list

std::map<std::string, int> pvWidgetIdManager::id_list
private

◆ id_start

int pvWidgetIdManager::id_start
private

◆ it

std::multimap<std::string, int>::iterator pvWidgetIdManager::it
private

◆ num_additional_widgets

int pvWidgetIdManager::num_additional_widgets
private

The documentation for this class was generated from the following file: