示例#1
0
static int trace_disconnect_bc( flow_tObject object)
{
  pwr_tSubid	*subid_p;
  vldh_t_node	vnode;
  int 		sts;
  flow_tTraceObj name;
  flow_tTraceAttr attr;
  flow_eTraceType type;
  int		inverted;

  printf( "DisConnecting something...\n");
  if ( flow_GetObjectType( object) == flow_eObjectType_Node)
  {
    if ( flow_GetNodeGroup( object) == flow_eNodeGroup_Trace)
    {
      flow_GetUserData( object, (void **) &subid_p);
      sts = gdh_UnrefObjectInfo( *subid_p);
      free( (char *) subid_p);
    }
    else
    {
      flow_GetTraceAttr( object, name, attr, &type, &inverted);
      if ( !( strcmp( name, "") == 0 || strcmp( attr, "") == 0)) {
        flow_GetUserData( object, (void **) &vnode);
        sts = gdh_UnrefObjectInfo( vnode->hn.trace_subid);
      }
    }
  }
  return 1;
}
示例#2
0
static void graph_object_dx_close( Graph *graph)
{
    graph_sObjectDx *od = (graph_sObjectDx *)graph->graph_object_data;

    if ( od->local_conv_p && od->conv_p)
        gdh_UnrefObjectInfo( od->conv_subid);
    if ( od->local_inv_p && od->inv_p)
        gdh_UnrefObjectInfo( od->inv_subid);
    if ( od->local_conv_p && od->test_p)
        gdh_UnrefObjectInfo( od->test_subid);

    free( graph->graph_object_data);
}
示例#3
0
static void CloseTrendList( trend_tCtx ctx)
{
  trend_sListEntry	    *ep, *tmp;

  /* Free old list */

  ep = ctx->o_list;
  while (ep != NULL) {
    tmp = ep;
    gdh_UnrefObjectInfo(ep->o->DataSubId);
    gdh_UnrefObjectInfo(ep->o_subid);
    ep = tmp->next;
    free(tmp);
  }
  ctx->o_list = NULL;
}
示例#4
0
static void pwrsrv_SubRemove( rpvd_sMsgSubRemove *msg)
{
  rpvd_sMsgAny rmsg;
  pwrsrv_sSubItem *si;
  
  rmsg.Type = rpvd_eMsg_Status;
  rmsg.Id = msg->Id;

  // Remove and unref
  for ( si = pwrsrv_sublist; si; si = si->next) {
    if ( si->rix == msg->Rix) {
      gdh_UnrefObjectInfo( si->dlid);
      if ( si->prev)
	si->prev->next = si->next;
      else
	pwrsrv_sublist = si->next;
      if ( si->next)
	si->next->prev = si->prev;
      free( (char *)si);
      break;
    }
  }
  printf( "SubRemove: %d\n", msg->Rix);

  rmsg.Status = GDH__SUCCESS;
  udp_Send( (char *)&rmsg, sizeof(rmsg));
}
示例#5
0
void ra_result::close()
{
  for (int i = 0;i < nValues_; i++)
    valueList_[i].close();
  
  gdh_UnrefObjectInfo(*dlid_);
  
  delete [] valueList_;
}
XttTrendMotif::~XttTrendMotif()
{
  timerid->remove();

  for ( int i = 0; i < trend_cnt; i++) {
    gdh_UnrefObjectInfo( subid[i]);
  }
  delete curve;
}
示例#7
0
XttFastMotif::~XttFastMotif()
{
  timerid->remove();

  for ( int i = 0; i < fast_cnt; i++) {
    gdh_UnrefObjectInfo( new_subid);
  }
  delete curve;
}
示例#8
0
XttFastGtk::~XttFastGtk()
{
  timerid->remove();

  for ( int i = 0; i < fast_cnt; i++) {
    gdh_UnrefObjectInfo( new_subid);
  }  
  delete curve;
  if ( gcd)
    delete gcd;
  delete wow;
}
示例#9
0
XttTrendQt::~XttTrendQt()
{
  debug_print("XttTrendQt::~XttTrendQt\n");
  if (timerid) {
    timerid->remove();
  }

  for (int i = 0; i < trend_cnt; i++) {
    gdh_UnrefObjectInfo(subid[i]);
  }
  if (gcd) {
    delete gcd;
  }
  if (otree) {
    delete otree;
  }
}
示例#10
0
int XAttNav::trace_disconnect_bc( brow_tObject object)
{
  Item 		*base_item;

  brow_GetUserData( object, (void **)&base_item);
  switch( base_item->type) {
  case xnav_eItemType_Attr:
  case xnav_eItemType_AttrArrayElem: {
    ItemAttr	*item = (ItemAttr *) base_item;
    
    gdh_UnrefObjectInfo( item->subid);
    break;
  }
  default:
    ;
  }
  return 1;
}
示例#11
0
static pwr_tStatus InitTrendList( trend_tCtx ctx)
{
  pwr_tStatus	    sts;
  pwr_tUInt32	    dummy;
  pwr_tTypeId	    type;
  int		    tix;
  pwr_tAttrRef	    aref;
  pwr_tAttrRef	    oaref;
  pwr_tAName   	    name;
  pwr_tDisableAttr  disabled;

  /* Init DsTrend objects */
  /* Scan through typelist and insert valid objects in list and initiate */
  /* the DsTrend objects. */

  for ( sts = gdh_GetClassListAttrRef(pwr_cClass_DsTrend, &aref); 
	ODD(sts); 
	sts = gdh_GetNextAttrRef( pwr_cClass_DsTrend, &aref, &aref) ) {
    trend_sListEntry    *ep;
    pwr_sClass_DsTrend  *o;

    sts = gdh_AttrrefToName( &aref, name, sizeof(name), cdh_mNName);  
    if (EVEN(sts))
      continue;

    /* Check if parent object is disabled */
    sts = gdh_AttrArefToObjectAref( &aref, &oaref);
    if ( ODD(sts)) {
      sts = gdh_ArefDisabled( &oaref, &disabled);
      if ( ODD(sts) && disabled)
	continue;
    }

    ep = calloc(1, sizeof(*ep));
    if (ep == NULL) {
      errh_CErrLog(DS__ERRALLOC, NULL);
      errh_SetStatus( PWR__SRVTERM);
      exit(DS__ERRALLOC);
    }

    sts = gdh_RefObjectInfo(name, (pwr_tAddress *)&ep->o, 
		      &ep->o_subid, sizeof(*ep->o));
    if (EVEN(sts)) {
      errh_Error("Couldn't get subscription for '%s'\n%m", name, sts);
      free(ep);
      continue;
    }
    o = ep->o;       

   /* Set init values */
    o->BufferStatus[0] = 1;
    o->BufferStatus[1] = 1;
    o->NoOfBuffers = 2;
    o->NoOfBufElement = 239;

    /* Initiate DsTrend object, sampled attribute must be on local node */	  

    sts = gdh_DLRefObjectInfoAttrref((pwr_sAttrRef *)&o->DataName, 
		  (pwr_tAddress *)&o->DataPointer, &o->DataSubId);
    if (EVEN(sts)) {
      if ( sts == GDH__RTDBNULL && IsDisabled( &o->DataName))
	  continue;

      errh_Error("Couldn't get direct link to %s's attribute DataName\n%m", name, sts);
      gdh_UnrefObjectInfo(ep->o_subid);
      free(ep);
      continue;
    }

    sts = gdh_GetAttributeCharAttrref((pwr_sAttrRef *)&o->DataName,
					&type, &dummy, &dummy, &dummy);
    if (EVEN(sts)) {
      errh_Error("Couldn't get datatype for %s's attribute DataName\n%m", name, sts);
      gdh_UnrefObjectInfo(ep->o_subid);
      free(ep);
      continue;
    }
    tix = cdh_TypeIdToIndex(type);

    if (!IsValidType(tix)) {
      errh_Error("No valid datatype for %s's attribute DataName\n%m", name, DS__ERRTYPE);
      gdh_UnrefObjectInfo(ep->o_subid);
      free(ep);
      continue;
    }
      
    o->DataType = tix;
    if ( o->Multiple == 0)
      o->Multiple = 1;
    o->NoOfSample = (o->StorageTime * ctx->scantime) / o->Multiple;

    if(o->NoOfSample > o->NoOfBufElement)
      o->NoOfSample = o->NoOfBufElement;

    o->ScanTime = ctx->scantime;

    ep->next = ctx->o_list;
    ctx->o_list = ep;
  }

  /* Init DsTrendCurve objects */

  /* Scan through typelist and insert valid objects in list and initiate
     the DsTrend objects.  */

  for (sts = gdh_GetClassListAttrRef(pwr_cClass_DsTrendCurve, &aref); 
       ODD(sts); 
       sts = gdh_GetNextAttrRef( pwr_cClass_DsTrendCurve, &aref, &aref) ) {
    trend_sListEntryTC  *ep;
    pwr_sClass_DsTrendCurve  *o;
    int i;
    int found;

    sts = gdh_AttrrefToName( &aref, name, sizeof(name), cdh_mNName);  
    if (EVEN(sts))
      continue;

    /* Check if parent object is disabled */
    sts = gdh_AttrArefToObjectAref( &aref, &oaref);
    if ( ODD(sts)) {
      sts = gdh_ArefDisabled( &oaref, &disabled);
      if ( ODD(sts) && disabled)
	continue;
    }

    ep = calloc(1, sizeof(*ep));
    if (ep == NULL) {
      errh_CErrLog(DS__ERRALLOC, NULL);
      errh_SetStatus( PWR__SRVTERM);
      exit(DS__ERRALLOC);
    }

    ep->first_scan = 1;

    sts = gdh_RefObjectInfo(name, (pwr_tAddress *)&ep->o, 
		      &ep->o_subid, sizeof(*ep->o));
    if (EVEN(sts)) {
      errh_Error("Couldn't get subscription for '%s'\n%m", name, sts);
      free(ep);
      continue;
    }
    o = ep->o;       

    if ( o->Function & 1) {
      /* Data stored by user */
      gdh_UnrefObjectInfo(ep->o_subid);
      free(ep);
      continue;
    }

    ep->multiple = (int) (o->ScanTime / ctx->scantime_tc + 0.5);
    o->NoOfSample = (int) (o->StorageTime / ctx->scantime_tc * ep->multiple + 0.5);

    /* Initiate DsTrendCuve object, sampled attribute must be on local node */	  

    found = 0;
    for ( i = 0; i < 10; i++) {
      if ( cdh_ObjidIsNull( o->Attribute[i].Objid))
	continue;

      /* Link to attribute */
      sts = gdh_DLRefObjectInfoAttrref((pwr_sAttrRef *)&o->Attribute[i], 
				       (pwr_tAddress *)&ep->datap[i], &ep->data_subid[i]);
      if (EVEN(sts)) {
	if ( sts == GDH__RTDBNULL && IsDisabled( &o->Attribute[i]))
	  continue;
	
	errh_Error("Couldn't get direct link to %s's attribute %d, %m", name, i+1, sts);
	ep->datap[i] = 0;
	continue;
      }
     
      sts = gdh_GetAttributeCharAttrref((pwr_sAttrRef *)&o->Attribute[i],
					&type, &dummy, &dummy, &dummy);
      if (EVEN(sts)) {
	errh_Error("Couldn't get datatype for %s's attribute DataName\n%m", name, sts);
	gdh_UnrefObjectInfo(ep->data_subid[i]);
	ep->datap[i] = 0;
	continue;
      }
      tix = cdh_TypeIdToIndex(type);
      ep->data_size[i] = cdh_TypeToSize( type);

      if (!IsValidType(tix)) {
	errh_Error("No valid datatype for %s's attribute DataName\n%m", name, DS__ERRTYPE);
	gdh_UnrefObjectInfo(ep->data_subid[i]);
	ep->datap[i] = 0;
	continue;
      }
      
      o->AttributeType[i] = type;

      /* Link to buffer */
      sts = gdh_DLRefObjectInfoAttrref((pwr_sAttrRef *)&o->Buffers[i], 
				       (pwr_tAddress *)&ep->buffheadp[i], &ep->buff_subid[i]);
      if (EVEN(sts)) {
	errh_Error("Couldn't get direct link to %s's buffer %d, %m", name, i+1, sts);
	gdh_UnrefObjectInfo(ep->data_subid[i]);
	ep->datap[i] = 0;
	continue;
      }
      ep->buffp[i] = (char *)ep->buffheadp[i] + pwr_AlignLW(sizeof(pwr_sClass_CircBuffHeader));

      /* Get buffer size */
      sts = gdh_GetAttributeCharAttrref( &o->Buffers[i], 0, &ep->buff_size[i], 0, 0);
      if ( EVEN(sts)) return sts;

      ep->buff_size[i] -= pwr_AlignLW(sizeof(pwr_sClass_CircBuffHeader));

      found = 1;
    }
    if ( !found) {
      errh_Error("No valid attributes for %s", name);
      gdh_UnrefObjectInfo(ep->o_subid);
      free(ep);
      continue;
    }

    /* Link to time buffer */
    if ( cdh_ObjidIsNotNull( o->TimeBuffer.Objid)) {
      sts = gdh_DLRefObjectInfoAttrref((pwr_sAttrRef *)&o->TimeBuffer, 
				       (pwr_tAddress *)&ep->timeheadp, &ep->timebuff_subid);
      if (EVEN(sts)) {
	errh_Error("Couldn't get direct link to %s's time buffer, %m", name, sts);
	ep->timeheadp = 0;
	ep->timebuffp = 0;
      }
      else
 	ep->timebuffp = (char *)ep->timeheadp + pwr_AlignLW(sizeof(pwr_sClass_CircBuffHeader));
	
      if ( o->TimeResolution == pwr_eTimeResolutionEnum_Nanosecond)
	ep->time_size = 8;
      else
	ep->time_size = 4;

      /* Get buffer size */
      sts = gdh_GetAttributeCharAttrref( &o->TimeBuffer, 0, &ep->timebuff_size, 0, 0);
      if ( EVEN(sts)) return sts;

      ep->timebuff_size -= pwr_AlignLW(sizeof(pwr_sClass_CircBuffHeader));
    }

    /* Calculate number of samples */
    for ( i = 0; i < 10; i++) {
      if ( !ep->datap[i])
	continue;

      if ( o->NoOfSample > ep->buff_size[i] / ep->data_size[i])
	o->NoOfSample = ep->buff_size[i] / ep->data_size[i];
    }
    if ( ep->timebuffp) {
      if ( o->NoOfSample > ep->timebuff_size / ep->time_size)
	o->NoOfSample = ep->timebuff_size / ep->time_size;
    }
    for ( i = 0; i < 10; i++) {
      if ( !ep->datap[i])
	continue;

      ep->buffheadp[i]->Size = o->NoOfSample;
      ep->buffheadp[i]->ElementSize = ep->data_size[i];
    }
    if ( ep->timebuffp) {
      ep->timeheadp->Size = o->NoOfSample;
      ep->timeheadp->ElementSize = ep->time_size;
    }
     
    ep->next = ctx->o_list_tc;
    ctx->o_list_tc = ep;
  }

  if ( ctx->o_list == NULL && ctx->o_list_tc == NULL)
    return DS__NOOBJECT;
  else
    return DS__SUCCESS;
}