Пример #1
0
pwr_tStatus wb_volume::syntaxCheckObject(wb_object& o, int *errorcount, int *warningcount)
{
  pwr_tStatus sts, csts;
  wb_object first, after;
  wb_attribute a(o.sts(), o);
  
  sts = triggSyntaxCheck(a, errorcount, warningcount);
  if (EVEN(sts)) return sts;

  // Get any attribute objects
  wb_cdef cd = cdef(o);
  if ( !cd) return cd.sts();

  wb_bdef bdef = cd.bdef(pwr_eBix_rt);
  wb_adef adef;
  if ( bdef) {
    for (adef = bdef.adef(); adef; adef = adef.next()) {
      if ( !(adef.flags() & PWR_MASK_CLASS))
	continue;

      if ( adef.flags() & PWR_MASK_ARRAY) {
	for ( int i = 0; i < adef.nElement(); i++) {
	  wb_attribute a( adef.sts(), o, adef, i);
	  
	  csts = syntaxCheckAttr( a, errorcount, warningcount);
	  if ( EVEN(csts)) sts = csts;
	}
      }
      else {
	wb_attribute a( adef.sts(), o, adef);
	
	if ( adef.flags() & PWR_MASK_DISABLEATTR && a.disabled())
	  continue;

	csts = syntaxCheckAttr( a, errorcount, warningcount);
	if ( EVEN(csts)) sts = csts;
      }
    }
  }


  for ( wb_object c = o.first(); c; c = c.after()) {
    if ( c.cid() == pwr_eClass_LibHier)
      continue;
    csts = syntaxCheckObject(c, errorcount, warningcount);
    if ( EVEN(csts))
      sts = csts;
  }

  return sts;
}
Пример #2
0
wb_object wb_session::copyObject(wb_object o, wb_destination d, wb_name name)
{
  wb_orep* orep = 0;

  if (isReadonly())
    throw wb_error_str("ReadOnlySession");

  validateDestination(d, o.cid());
  if (evenSts())
    throw wb_error(sts());

  wb_object parent;
  switch (d.code()) {
  case ldh_eDest_IntoFirst:
  case ldh_eDest_IntoLast:
    parent = object(d.oid());
    break;
  case ldh_eDest_After:
  case ldh_eDest_Before:
    parent = object(d.oid()).parent();
    break;
  default:
    throw wb_error(LDH__NODEST);
  }

  m_sts = triggAnteCreate(parent, o.cid());
  if (evenSts())
    throw wb_error(sts());
  m_sts = triggAnteAdopt(parent, o.cid());
  if (evenSts())
    throw wb_error(sts());

  if (m_vrep->vid() == o.vid()) {
    orep = m_vrep->copyObject(&m_sts, (wb_orep*)o, d, name);
    if (evenSts())
      throw wb_error(sts());

    orep->ref();
  } else {
    wb_cdef c = cdef(o.cid());

    orep = m_vrep->createObject(&m_sts, c, d, name);
    orep->ref();
    wb_attribute rba(o.sts(), (wb_orep*)o, "RtBody");
    if (rba) {
      void* p = rba.value();
      wb_attribute rban(m_sts, orep, "RtBody");
      writeAttribute(rban, p);
    }
    wb_attribute dba(o.sts(), (wb_orep*)o, "DevBody");
    if (dba) {
      void* p = dba.value();
      wb_attribute dban(m_sts, orep, "DevBody");
      writeAttribute(dban, p);
    }
    wb_attribute sba(o.sts(), (wb_orep*)o, "SysBody");
    if (sba) {
      void* p = sba.value();
      wb_attribute sban(m_sts, orep, "SysBody");
      writeAttribute(sban, p);
    }
  }
  m_srep->update();

  wb_object onew = wb_object(m_sts, orep);
  orep->unref();
  ldh_sEvent* ep = m_srep->eventStart(onew.oid(), ldh_eEvent_ObjectCreated);
  m_srep->eventNewFamily(ep, onew);
  triggPostCreate(onew);
  triggPostAdopt(parent, onew);
  m_srep->eventSend(ep);

  return onew;
}
Пример #3
0
wb_object::wb_object(const wb_object& x) : wb_status(x.sts()), m_orep(x.m_orep)
{
  if (m_orep)
    m_orep->ref();
}