当前位置: 首页>>代码示例>>C++>>正文


C++ DataElement类代码示例

本文整理汇总了C++中DataElement的典型用法代码示例。如果您正苦于以下问题:C++ DataElement类的具体用法?C++ DataElement怎么用?C++ DataElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DataElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ACE_TRACE

// Listing 1 code/ch05
int StackExample::runBoundedStack (void)
{
  ACE_TRACE (ACE_TEXT ("StackExample::runBoundedStack"));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Using a bounded stack\n")));

  ACE_Bounded_Stack<DataElement> bstack1 (100);

  // The element array is constrained to this scope.
  {
    DataElement elem[100];
    for (int i = 0; i < 100; i++)
      {
        elem[i].setData(i);
        // Push the element on the stack.
        bstack1.push (elem[i]);
      }
  }

  ACE_Bounded_Stack<DataElement> bstack2 (100);

  // Make a copy!
  bstack2 = bstack1;
  for (int j = 0; j < 100; j++)
    {
      DataElement elem;
      bstack2.pop (elem);
      ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d:"), elem.getData ()));
    }

  return 0;
}
开发者ID:azraelly,项目名称:knetwork,代码行数:32,代码来源:Stacks.cpp

示例2: throw

// Decode this element starting at the index in the provided buffer
size_t HLAfixedArray::decodeFrom( const std::vector<Octet>& buffer, size_t index )
throw( EncoderException )
{
    size_t available = buffer.size();
    if( index + BitHelpers::LENGTH_INT > available )
        throw EncoderException( L"Insufficient data in buffer to decode value" );

    // Decode received array size
    HLAinteger32BE size;
    index = size.decodeFrom( buffer, index );

    size_t receivedSize = size.get();
    if( receivedSize != this->size() )
    {
        // Received array size was different to what we were expecting, so throw an exception
        std::wstringstream stream;
        stream << L"Element count in decoded array differs. Expected[" <<
               this->size() <<
               "] Received [" <<
               receivedSize << "]";

        throw EncoderException( stream.str() );
    }

    // Decode all the elements!
    for( size_t i = 0 ; i < receivedSize ; ++i )
    {
        DataElement* element = this->_impl->get( i );
        index = element->decodeFrom( buffer, index );
    }

    return index;
}
开发者ID:JeanPhilippeLebel,项目名称:portico,代码行数:34,代码来源:HLAfixedArray.cpp

示例3: readStatusMessage

void ClientChatRoom::readStatusMessage(DataElement data)
{
    quint32 id = data.readInt32();
    QString string = data.readString();
    switch(data.subType())
    {
    case 0:
        //qDebug() << "User joined id: " << id << " name: " << string;
        userInfo.append(UserInfo(id, string, Online));
        window->setUserList(userInfo);
        break;
    case 5:
        //qDebug() << "User left id: " << id << " name: " << string;
        for(int i=0;i<userInfo.length(); ++i)
        {
            if(userInfo[i].id == id)
            {
                userInfo.removeAt(i);
                break;
            }
        }
        window->setUserList(userInfo);
        break;
    }
}
开发者ID:Xeemed,项目名称:TM2011C1.4,代码行数:25,代码来源:clientchatroom.cpp

示例4: throw

// Decode this element starting at the index in the provided buffer
size_t HLAvariableArray::decodeFrom( const std::vector<Octet>& buffer, size_t index )
	throw( EncoderException )
{
	size_t available = buffer.size();
	if( index + BitHelpers::LENGTH_INT > available )
		throw EncoderException( L"Insufficient data in buffer to decode value" );

	// Decode received array size
	HLAinteger32BE size;
	index = size.decodeFrom( buffer, index );
	size_t receivedSize = size.get();

	// Resize to the new element count. This will either add element clones, or cull the end of
	// the existing list until it is the right size
	this->_impl->resize( receivedSize );

	// Decode all the elements!
	for( size_t i = 0 ; i < receivedSize ; ++i )
	{
		DataElement* element = this->_impl->get( i );
		index = element->decodeFrom( buffer, index );
	}

	return index;
}
开发者ID:JeanPhilippeLebel,项目名称:portico,代码行数:26,代码来源:HLAvariableArray.cpp

示例5: initialize

bool EngrdaWidget::initialize(SessionItem* pSessionItem)
{
   DataElement* pElement = dynamic_cast<DataElement*>(pSessionItem);
   DataDescriptor* pDesc = (pElement == NULL) ? NULL : pElement->getDataDescriptor();
   const DynamicObject* pMeta = (pDesc == NULL) ? NULL : pDesc->getMetadata();
   return initialize(pMeta);
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:7,代码来源:EngrdaWidget.cpp

示例6: queryZDNames

bool ZoneData::queryZDNames(int simNum,
                            int zoneNum,
                            vector<string> &names)
{
    int numZDs = 0;
    Tools::ClassManager *cm = Tools::ClassManager::getInstance();
    DataElement *zdInfo = NULL;

    names.clear();

    if (queryNumZDs(simNum, zoneNum, numZDs))
    {
        zdInfo = (DataElement *)cm->getObject("DTF_Lib::DataElement");
        for (int i = 0; i < numZDs; i++)
            if (queryZDbyNum(simNum, zoneNum, i, *zdInfo))
                names.push_back(zdInfo->getName());

        if (zdInfo != NULL)
        {
            cm->deleteObject(zdInfo->getID());
            zdInfo = NULL;
        }

        return true;
    }

    return false;
}
开发者ID:nixz,项目名称:covise,代码行数:28,代码来源:zonedata.cpp

示例7: initialize

bool PropertiesWavelengths::initialize(SessionItem* pSessionItem)
{
   WavelengthsWidget* pWavelengthsPage = dynamic_cast<WavelengthsWidget*>(getWidget());
   if (pWavelengthsPage == NULL)
   {
      return false;
   }

   DataElement* pElement = dynamic_cast<DataElement*>(pSessionItem);
   if (pElement != NULL)
   {
      RasterDataDescriptor* pDescriptor = dynamic_cast<RasterDataDescriptor*>(pElement->getDataDescriptor());
      if (pDescriptor != NULL)
      {
         const DynamicObject* pMetadata = pElement->getMetadata();
         if (pMetadata != NULL)
         {
            mWavelengths.initializeFromDynamicObject(pMetadata, true);
            pWavelengthsPage->setWavelengths(pDescriptor->getBands(), &mWavelengths);
            return PropertiesShell::initialize(pSessionItem);
         }
      }
   }

   return false;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:26,代码来源:PropertiesWavelengths.cpp

示例8: initialize

bool PropertiesFileDescriptor::initialize(SessionItem* pSessionItem)
{
   FileDescriptorWidget* pDescriptorPage = dynamic_cast<FileDescriptorWidget*>(getWidget());
   if (pDescriptorPage == NULL)
   {
      return false;
   }

   DataElement* pElement = dynamic_cast<DataElement*>(pSessionItem);
   if (pElement != NULL)
   {
      DataDescriptor* pDescriptor = pElement->getDataDescriptor();
      if (pDescriptor != NULL)
      {
         const FileDescriptor* pFileDescriptor = pDescriptor->getFileDescriptor();
         if (pFileDescriptor != NULL)
         {
            pDescriptorPage->setFileDescriptor(pFileDescriptor);
            return true;
         }
      }
   }

   return false;
}
开发者ID:wzssyqa,项目名称:opticks-cmake,代码行数:25,代码来源:PropertiesFileDescriptor.cpp

示例9: ACE_TRACE

// Listing 1 code/ch05
int QueueExample::runStackUnboundedQueue (void)
{
  ACE_TRACE ("QueueExample::runStackUnboundedQueue");

  ACE_Unbounded_Queue<DataElement> queue;
  DataElement elem1[10];
  int i;
  for (i = 0; i < 10; i++)
    {
      elem1[i].setData (9-i);
      queue.enqueue_head (elem1[i]);
    }

  DataElement elem2[10];
  for (i = 0; i < 10; i++)
    {
      elem2[i].setData (i+10);
      queue.enqueue_tail (elem2[i]);
    }

  for (ACE_Unbounded_Queue_Iterator<DataElement> iter (queue);
       !iter.done ();
       iter.advance ())
    {
      DataElement *elem = 0;
      iter.next (elem);
      ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d:"), elem->getData ()));
    }

  return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:32,代码来源:Queues.cpp

示例10: ACE_TRACE

// Listing 1
// Listing 2 code/ch05
int SetExample::runUnboundedSet ()
{
  ACE_TRACE (ACE_TEXT ("SetExample::runUnboundedSet"));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Using an unbounded set.\n")));
  ACE_Unbounded_Set<DataElement*> uset;
  for (int m = 0; m < 100; m++)
    {
      DataElement *elem;
      ACE_NEW_RETURN (elem, DataElement (m), -1);
      uset.insert (elem);
    }
  DataElement deBegin (0), deEnd (99);
  if (!uset.find (&deBegin) && !uset.find (&deEnd))
    {
      ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Found the elements\n")));
    }

  // Iterate and destroy the elements in the set.
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Deleting the elements\n")));
  ACE_Unbounded_Set_Iterator<DataElement*> iter (uset);
  for (iter = uset.begin (); iter != uset.end (); iter++)
    {
      DataElement* elem = (*iter);
      ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d:"), elem->getData ()));
      delete elem;
    }

  return 0;
}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:31,代码来源:Sets.cpp

示例11: ACE_TRACE

int Hash_Map_Example::run (void)
{
  ACE_TRACE ("Hash_Map_Example::run");

  for (int i = 0; i < 100; i++)
    {
      map_.bind (i, DataElement (i));
    }

  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Map has\n")));
  for (int j = 0; j < 100; j++)
    {
      DataElement d;
      map_.find (j, d);
      ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d:"), d.getData ()));
    }
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));

  // Use the forward iterator.
  this->iterate_forward ();

  // Use the reverse iterator.
  this->iterate_reverse ();

  // Remove all the elements from the map.
  this->remove_all ();

  // Iterate through the map again.
  this->iterate_forward ();

  return 0;
}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:32,代码来源:Hash_Map_Hash.cpp

示例12:

vector<string> ModelServicesImp::getElementNames(const string& filename, const string& type) const
{
    vector<string> elementNames;

    multimap<Key, DataElement*>::const_iterator iter;
    for (iter = mElements.begin(); iter != mElements.end(); ++iter)
    {
        DataElement* pElement = iter->second;
        if (pElement != NULL)
        {
            string currentFilename = pElement->getFilename();
            string lowerCurrentFilename = StringUtilities::toLower(currentFilename);
            string lowerElementFilename = StringUtilities::toLower(filename);

            if (lowerCurrentFilename == lowerElementFilename)
            {
                if ((type.empty() == true) || (pElement->isKindOf(type) == true))
                {
                    elementNames.push_back(pElement->getName());
                }
            }
        }
    }

    return elementNames;
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例13: endElement

DECLARE_EXPORT void Solver::endElement(XMLInput& pIn, const Attribute& pAttr, const DataElement& pElement)
{
  if (pAttr.isA(Tags::tag_loglevel))
  {
    int i = pElement.getInt();
    if (i<0 || i>USHRT_MAX)
      throw DataException("Invalid log level" + pElement.getString());
    setLogLevel(i);
  }
}
开发者ID:dhl,项目名称:frePPLe,代码行数:10,代码来源:solver.cpp

示例14: VERIFYRV

SpatialDataViewImp* OverviewWindow::createOverview()
{
   SpatialDataViewImp* pOverview = NULL;
   if (mpView != NULL)
   {
      pOverview = dynamic_cast<SpatialDataViewImp*>(mpView->copy());
      VERIFYRV(pOverview != NULL, NULL);
      pOverview->installEventFilter(this);

      LayerList* pLayerList = NULL;
      pLayerList = pOverview->getLayerList();
      if (pLayerList != NULL)
      {
         // get primary raster layer from data view
         LayerList* pSDVlist = mpView->getLayerList();
         VERIFYRV(pSDVlist != NULL, NULL);
         DataElement* pPrimElem = pSDVlist->getPrimaryRasterElement();
         VERIFYRV(pPrimElem != NULL, NULL);
         Layer* pPrimLayer = pSDVlist->getLayer(RASTER, pPrimElem);
         VERIFYRV(pPrimLayer != NULL, NULL);
         string primName(pPrimLayer->getName());

         vector<Layer*> layers;
         pLayerList->getLayers(layers);
         for (unsigned int i = 0; i < layers.size(); i++)
         {
            Layer* pLayer = NULL;
            pLayer = layers.at(i);
            string layerName(pLayer->getName());
            if (pLayer->getLayerType()==RASTER && layerName==primName)
            {
               pPrimLayer->linkLayer(pLayer);

               // reset the scale to what is in the model
               DataElement* pElement = pLayer->getDataElement();
               VERIFYRV(pElement != NULL, NULL);

               const RasterDataDescriptor* pDescriptor =
                  dynamic_cast<const RasterDataDescriptor*>(pElement->getDataDescriptor());
               VERIFYRV(pDescriptor != NULL, NULL);

               pLayer->setYScaleFactor(pDescriptor->getYPixelSize());
               pLayer->setXScaleFactor(pDescriptor->getXPixelSize());
            }
            else
            {
               pOverview->deleteLayer(pLayer);
            }
         }
         pOverview->resetOrientation();
      }
   }

   return pOverview;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:55,代码来源:OverviewWindow.cpp

示例15: endElement

void HasDescription::endElement(DataInput& pIn, const Attribute& pAttr, const DataElement& pElement)
{
  if (pAttr.isA(Tags::tag_category))
    setCategory(pElement.getString());
  else if (pAttr.isA(Tags::tag_subcategory))
    setSubCategory(pElement.getString());
  else if (pAttr.isA(Tags::tag_description))
    setDescription(pElement.getString());
  else if (pAttr.isA(Tags::tag_source))
    setSource(pElement.getString());
}
开发者ID:WHELLINCK,项目名称:frePPLe,代码行数:11,代码来源:library.cpp


注:本文中的DataElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。