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


C++ Archive类代码示例

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


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

示例1: SEISCOMP_ERROR

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void EnvelopeChannel::serialize(Archive& ar) {
	// Do not read/write if the archive's version is higher than
	// currently supported
	if ( ar.isHigherVersion<0,9>() ) {
		SEISCOMP_ERROR("Archive version %d.%d too high: EnvelopeChannel skipped",
		               ar.versionMajor(), ar.versionMinor());
		ar.setValidity(false);
		return;
	}

	PublicObject::serialize(ar);
	if ( !ar.success() ) return;

	ar & NAMED_OBJECT_HINT("name", _name, Archive::XML_MANDATORY);
	ar & NAMED_OBJECT_HINT("waveformID", _waveformID, Archive::STATIC_TYPE | Archive::XML_ELEMENT | Archive::XML_MANDATORY);
	if ( ar.hint() & Archive::IGNORE_CHILDS ) return;
	ar & NAMED_OBJECT_HINT("value",
	                       Seiscomp::Core::Generic::containerMember(_envelopeValues,
	                       Seiscomp::Core::Generic::bindMemberFunction<EnvelopeValue>(static_cast<bool (EnvelopeChannel::*)(EnvelopeValue*)>(&EnvelopeChannel::add), this)),
	                       Archive::STATIC_TYPE);
}
开发者ID:Fran89,项目名称:seiscomp3,代码行数:22,代码来源:envelopechannel.cpp

示例2: load

    void address::load(Archive& ar, const unsigned int version)
    {
        if (version > HPX_ADDRESS_VERSION)
        {
            HPX_THROW_EXCEPTION(version_too_new,
                "address::load",
                "trying to load address with unknown version");
        }

        if (ar.flags() & util::disable_array_optimization) {
            ar >> locality_ >> type_ >> address_;
        }
开发者ID:41i,项目名称:hpx,代码行数:12,代码来源:address.cpp

示例3: deserialize

void ActionText::deserialize(Archive &archive) {
	Action::deserialize(archive);
	_fileName = archive.readString();

	_xLeft = archive.readDWORD();
	_yTop = archive.readDWORD();
	_xRight = archive.readDWORD();
	_yBottom = archive.readDWORD();

	_centered = archive.readDWORD();
	_scrollBar = archive.readDWORD();
	_textColor = archive.readDWORD();
	_backgroundColor = archive.readDWORD();
}
开发者ID:vladimir-zahradnik,项目名称:scummvm,代码行数:14,代码来源:action_text.cpp

示例4: store

bool KinematicFaultCheckerImpl::store(Archive& archive)
{
    archive.write("checkJointPositions", positionCheck.isChecked());
    archive.write("angleMargin", angleMarginSpin.value());
    archive.write("translationMargin", translationMarginSpin.value());
    archive.write("checkJointVelocities", velocityCheck.isChecked());
    archive.write("velocityLimitRatio", velocityLimitRatioSpin.value());
    archive.write("targetJoints",
                  (allJointsRadio.isChecked() ? "all" :
                   (selectedJointsRadio.isChecked() ? "selected" : "non-selected")));
    archive.write("checkSelfCollisions", collisionCheck.isChecked());
    archive.write("onlyTimeBarRange", onlyTimeBarRangeCheck.isChecked());
    return true;
}
开发者ID:fkanehiro,项目名称:choreonoid,代码行数:14,代码来源:KinematicFaultChecker.cpp

示例5: serializeDynamicArray

 inline void serializeDynamicArray(
     RCF::TrueType *,
     Archive &ar,
     DynamicArray<T,N> &da)
 {
     if (ar.isRead())
     {
         I_Encoding &e = ar.getIstream()->getEncoding();
         DataPtr data;
         bool bRet = ar.getIstream()->get( data );
         if (bRet)
         {
             UInt32 nCount = e.getCount( data , (T *) NULL);
             da.get() = new T[ nCount ];
             da.length() = nCount;
             e.toObject(data, da.get(), nCount );
         }
     }
     else if (ar.isWrite())
     {
         if (da.length() > 0)
         {
             I_Encoding &e = ar.getOstream()->getEncoding();
             DataPtr data;
             e.toData(data, da.get(), da.length() );
             ar.getOstream()->put(data);
         }
     }
 }
开发者ID:rajkosto,项目名称:deps-rcf,代码行数:29,代码来源:SerializeDynamicArray.hpp

示例6: run

void ArchiveParser::run (Archive &archive)
{
    ChannelIterator channel (archive);
    ValueIterator value (archive);
    stdString parameter, arg;
    bool go = true;

    while (go && nextLine ())
    {
        if (getParameter (parameter, arg))
        {
            if (parameter == "channel")
            {
                if (archive.findChannelByName (arg, channel))
                {
                    _last_time = channel->getLastTime ();
                }
                else
                {
                    if (! archive.addChannel (arg, channel))
                    {
                        printf("Cannot add channel '%s' to archive\n",
                               arg.c_str());
                        return;
                    }
                    _last_time = nullTime;
                }
            }
        }
        else
        {
            if (getLine() == "Header")
                go = handleHeader(archive);
            else if (getLine() == "CtrlInfo")
                go = handleCtrlInfo(channel);
            else
                go = handleValue(channel);
        }
    }
}
开发者ID:epicsdeb,项目名称:channelarchiver,代码行数:40,代码来源:ascii.cpp

示例7: serialize

void ParseTree::serialize(Archive & ar, const unsigned int version)
{
    ar.register_type(static_cast<PtNode *>(NULL));
    ar.register_type(static_cast<PtEdge *>(NULL));
    ar.register_type(static_cast<Appearance::Param *>(NULL));
    ar.register_type(static_cast<Deformation::Param *>(NULL));
    ar.register_type(static_cast<Scaleprior::Param *>(NULL));
    ar.register_type(static_cast<ParseInfo *>(NULL));
    ar.register_type(static_cast<States *>(NULL));

    ar.template register_type<PtNode>();
    ar.template register_type<PtEdge>();
    ar.template register_type<Appearance::Param>();
    ar.template register_type<Deformation::Param>();
    ar.template register_type<Scaleprior::Param>();
    ar.template register_type<ParseInfo>();
    ar.template register_type<States>();

    ar & BOOST_SERIALIZATION_NVP(nodeSet_);
    ar & BOOST_SERIALIZATION_NVP(edgeSet_);
    ar & BOOST_SERIALIZATION_NVP(idxRootNode_);
    ar & BOOST_SERIALIZATION_NVP(appearanceSet_);
    ar & BOOST_SERIALIZATION_NVP(biasSet_);
    ar & BOOST_SERIALIZATION_NVP(deformationSet_);
    ar & BOOST_SERIALIZATION_NVP(scalepriorSet_);
    ar & BOOST_SERIALIZATION_NVP(parseInfoSet_);
    ar & BOOST_SERIALIZATION_NVP(dataId_);
    ar & BOOST_SERIALIZATION_NVP(states_);
    ar & BOOST_SERIALIZATION_NVP(appearanceX_);
    ar & BOOST_SERIALIZATION_NVP(imgWd_);
    ar & BOOST_SERIALIZATION_NVP(imgHt_);
}
开发者ID:LHY20,项目名称:AOGDetector,代码行数:32,代码来源:ParseTree.cpp

示例8:

void SimpleElementMapSerializer<KeyT>::Serialize(Archive& archive) const
{
    V_Element components;
    components.resize(m_Data->size() * 2);

    {
        DataType::const_iterator itr = m_Data->begin();
        DataType::const_iterator end = m_Data->end();
        for ( int i = 0; itr != end; ++itr )
        {
            if (!itr->second.ReferencesObject())
            {
                continue;
            }

            ElementPtr elem;
            archive.GetCache().Create( Reflect::GetType<KeyT>(), elem );

            Serializer* ser = AssertCast<Serializer>(elem.Ptr());
            ser->ConnectData((void*)&(itr->first));

            components[i++] = ser;
            components[i++] = itr->second;
        }
    }

    archive.Serialize(components);

    {
        V_Element::iterator itr = components.begin();
        V_Element::iterator end = components.end();
        for ( ; itr != end; ++itr )
        {
            Serializer* ser = AssertCast<Serializer>(*itr);
            ser->Disconnect();
            archive.GetCache().Free(ser);
            ++itr;
        }
    }
}
开发者ID:andyburke,项目名称:Replicant,代码行数:40,代码来源:ElementMapSerializer.cpp

示例9: ExtractStreamsNew

void ExtractStreamsNew(Archive &Arc,char *FileName,wchar *FileNameW)
{
  if (!WinNT())
    return;

  wchar NameW[NM];
  if (FileNameW!=NULL && *FileNameW!=0)
    strcpyw(NameW,FileNameW);
  else
    CharToWide(FileName,NameW);
  wchar StreamNameW[NM+2];
  if (NameW[0]!=0 && NameW[1]==0)
  {
    strcpyw(StreamNameW,L".\\");
    strcpyw(StreamNameW+2,NameW);
  }
  else
    strcpyw(StreamNameW,NameW);

  wchar *DestName=StreamNameW+strlenw(StreamNameW);
  byte *SrcName=&Arc.SubHead.SubData[0];
  int DestSize=Arc.SubHead.SubData.Size()/2;

  if (strlenw(StreamNameW)+DestSize>=sizeof(StreamNameW)/sizeof(StreamNameW[0]))
  {
#if !defined(SILENT) && !defined(SFX_MODULE)
    Log(Arc.FileName,St(MStreamBroken),FileName);
#endif
    ErrHandler.SetErrorCode(CRC_ERROR);
    return;
  }

  RawToWide(SrcName,DestName,DestSize);
  DestName[DestSize]=0;

  FindData fd;
  bool Found=FindFile::FastFind(FileName,FileNameW,&fd);

  if (fd.FileAttr & FILE_ATTRIBUTE_READONLY)
    SetFileAttr(FileName,FileNameW,fd.FileAttr & ~FILE_ATTRIBUTE_READONLY);
  char StreamName[NM];
  WideToChar(StreamNameW,StreamName);
  File CurFile;
  if (CurFile.WCreate(StreamName,StreamNameW) && Arc.ReadSubData(NULL,&CurFile))
    CurFile.Close();
  File HostFile;
  if (Found && HostFile.Open(FileName,FileNameW,true,true))
    SetFileTime(HostFile.GetHandle(),&fd.ftCreationTime,&fd.ftLastAccessTime,
                &fd.ftLastWriteTime);
  if (fd.FileAttr & FILE_ATTRIBUTE_READONLY)
    SetFileAttr(FileName,FileNameW,fd.FileAttr);
}
开发者ID:Akkarinage,项目名称:Neoncube,代码行数:52,代码来源:win32stm.cpp

示例10: resolve

void resolve( Archive& archive, int mode, ptr<Type>& object )
{
    ObjectGuard<Archive> guard( archive, 0, object.get(), mode );
    switch ( mode )
    {
        case MODE_VALUE:
            if ( object.get() )
            {
                archive.track( object.get(), &object );
                archive.persist( SWEET_TYPEID(*object.get()), archive, object.get() );
            }
            break;

        case MODE_REFERENCE:
            archive.reference( 0, reinterpret_cast<void**>(&object), &resolver<ptr<Type> >::resolve );
            break;

        default:
            SWEET_ASSERT( false );
            break;
    }
}
开发者ID:cwbaker,项目名称:sweet_persist,代码行数:22,代码来源:ptr.hpp

示例11: save

 void id_type_impl::save(Archive& ar, const unsigned int version) const
 {
     if(ar.flags() & util::disable_array_optimization) {
         naming::gid_type split_id(prepare_gid());
         ar << split_id << type_;
     }
     else {
         gid_serialization_data data;
         data.gid_ = prepare_gid();
         data.type_ = type_;
         ar << boost::serialization::make_array(&data, 1);
     }
 }
开发者ID:shivshnkr,项目名称:hpx,代码行数:13,代码来源:name.cpp

示例12: wxT

bool EditorConfig::WriteObject(const wxString &name, SerializedObject *obj)
{
	Archive arch;
	
	wxXmlNode *child = XmlUtils::FindNodeByName(m_doc->GetRoot(), wxT("ArchiveObject"), name);
	if(child){
		wxXmlNode *n = m_doc->GetRoot();
		n->RemoveChild(child);
		delete child;
	} // if(child)

	//create new xml node for this object
	child = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("ArchiveObject"));
	m_doc->GetRoot()->AddChild(child);
	child->AddProperty(wxT("Name"), name);

	arch.SetXmlNode(child);
	//serialize the object into the archive
	obj->Serialize(arch);
	//save the archive
	return m_doc->Save(m_fileName.GetFullPath());
}
开发者ID:BackupTheBerlios,项目名称:codelite-svn,代码行数:22,代码来源:editor_config.cpp

示例13: restore

bool SensorVisualizerItem::restore(const Archive& archive)
{
    impl->restoredSubItems.clear();

    ListingPtr subItems = archive.findListing("subItems");
    if(subItems->isValid()){
        for(int i=0; i < subItems->size(); i++){
            Archive* subArchive = dynamic_cast<Archive*>(subItems->at(i)->toMapping());
            string className, itemName;
            subArchive->read("class", className);
            subArchive->read("name", itemName);

            ItemPtr item;
            item = ItemManager::create("Body", className);
            item->setName(itemName);

            item->restore(*subArchive);
            impl->restoredSubItems.push_back(item);
        }
    }
    return true;
}
开发者ID:kindsenior,项目名称:choreonoid,代码行数:22,代码来源:SensorVisualizerItem.cpp

示例14: ss

Resource* ResourceSystem::open(const ArchiveResourceIdentifier& ari, Enums::ResourceAccess access)
{
 Archive* archive = 0;
 for (unsigned int i=0;i < mArchives.size(); i++)
 {
  if (mArchives[i]->getNameHash() == ari.getArchiveHash())
  {
   archive = mArchives[i];
   break;
  }
 }
 
 if (archive == 0)
 {  SharedStringStream ss(200);
  ss << "Could not open resource '" << ari.getArchive() << ":" << ari.getResourceName() << "\n"
     << "Reason: Archive could not be found.";
  NxOgre_ThrowError(ss.get());
  return 0;
 }
 
 return archive->open(ari, access);
}
开发者ID:EdCampion,项目名称:nxogre,代码行数:22,代码来源:NxOgreResourceSystem.cpp

示例15: load_collection

inline void load_collection(Archive & ar, Container &s)
{
    s.clear();
    const boost::archive::library_version_type library_version(
        ar.get_library_version()
    );
    // retrieve number of elements
    item_version_type item_version(0);
    collection_size_type count;
    ar >> BOOST_SERIALIZATION_NVP(count);
    if(boost::archive::library_version_type(3) < library_version){
        ar >> BOOST_SERIALIZATION_NVP(item_version);
    }
开发者ID:CasparCG,项目名称:Client,代码行数:13,代码来源:collections_load_imp.hpp


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