Ejemplo n.º 1
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
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);
}
Ejemplo n.º 2
0
Archivo: address.cpp Proyecto: 41i/hpx
    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_;
        }
Ejemplo n.º 3
0
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();
}
Ejemplo n.º 4
0
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;
}
Ejemplo n.º 5
0
 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);
         }
     }
 }
Ejemplo n.º 6
0
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);
        }
    }
}
Ejemplo n.º 7
0
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_);
}
Ejemplo n.º 8
0
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;
        }
    }
}
Ejemplo n.º 9
0
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);
}
Ejemplo n.º 10
0
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;
    }
}
Ejemplo n.º 11
0
 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);
     }
 }
Ejemplo n.º 12
0
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());
}
Ejemplo n.º 13
0
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;
}
Ejemplo n.º 14
0
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);
}
Ejemplo n.º 15
0
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);
    }
 //-----------------------------------------------------------------------
 ArchiveManager::~ArchiveManager()
 {
     // Unload & delete resources in turn
     for( ArchiveMap::iterator it = mArchives.begin(); it != mArchives.end(); ++it )
     {
         Archive* arch = it->second;
         // Unload
         arch->unload();
         // Find factory to destroy
         ArchiveFactoryMap::iterator fit = mArchFactories.find(arch->getType());
         if (fit == mArchFactories.end())
         {
             // Factory not found
             OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "Cannot find an archive factory "
             "to deal with archive of type " + arch->getType(), "ArchiveManager::~ArchiveManager");
         }
         fit->second->destroyInstance(arch);
         
     }
     // Empty the list
     mArchives.clear();
 }
Ejemplo n.º 17
0
inline void load_hash_collection(Archive & ar, Container &s)
{
    collection_size_type count;
    collection_size_type bucket_count;
    boost::serialization::item_version_type item_version(0);
    boost::archive::library_version_type library_version(
        ar.get_library_version()
    );
    // retrieve number of elements
    if(boost::archive::library_version_type(6) != library_version){
        ar >> BOOST_SERIALIZATION_NVP(count);
        ar >> BOOST_SERIALIZATION_NVP(bucket_count);
    }
Ejemplo n.º 18
0
/* ZipArchive::detectMaps
 * Detects all the maps in the archive and returns a vector of
 * information about them.
 *******************************************************************/
vector<Archive::mapdesc_t> ZipArchive::detectMaps()
{
	vector<mapdesc_t> ret;

	// Get the maps directory
	ArchiveTreeNode* mapdir = getDir("maps");
	if (!mapdir)
		return ret;

	// Go through entries in map dir
	for (unsigned a = 0; a < mapdir->numEntries(); a++)
	{
		ArchiveEntry* entry = mapdir->getEntry(a);

		// Maps can only be wad archives
		if (entry->getType()->getFormat() != "archive_wad")
			continue;

		// Detect map format (probably kinda slow but whatever, no better way to do it really)
		int format = MAP_UNKNOWN;
		Archive* tempwad = new WadArchive();
		tempwad->open(entry);
		vector<mapdesc_t> emaps = tempwad->detectMaps();
		if (emaps.size() > 0)
			format = emaps[0].format;
		delete tempwad;

		// Add map description
		mapdesc_t md;
		md.head = entry;
		md.end = entry;
		md.archive = true;
		md.name = entry->getName(true).Upper();
		md.format = format;
		ret.push_back(md);
	}

	return ret;
}
Ejemplo n.º 19
0
inline void load(
    Archive & ar,
    std::vector<U, Allocator> &t,
    const unsigned int /* file_version */,
    mpl::true_
){
    collection_size_type count(t.size());
    ar >> POTHOS_SERIALIZATION_NVP(count);
    t.resize(count);
    unsigned int item_version=0;
    if(POTHOS_SERIALIZATION_VECTOR_VERSIONED(ar.get_library_version())) {
        ar >> POTHOS_SERIALIZATION_NVP(item_version);
    }
Ejemplo n.º 20
0
bool XmlUtils::StaticReadObject(wxXmlNode* root, const wxString& name, SerializedObject* obj)
{
	//find the object node in the xml file
	
	wxXmlNode *node = XmlUtils::FindNodeByName(root, wxT("ArchiveObject"), name);
	if (node) {
		
		// Check to see if we need a version check
		wxString objectVersion = obj->GetVersion();
		if(objectVersion.IsEmpty() == false) {
			if(node->GetPropVal(wxT("Version"), wxT("")) != objectVersion) {
				return false;
			}
		}
		
		Archive arch;
		arch.SetXmlNode(node);
		obj->DeSerialize(arch);
		return true;
	}
	return false;
}
Ejemplo n.º 21
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void ConfigModule::serialize(Archive& ar) {
	// Do not read/write if the archive's version is higher than
	// currently supported
	if ( ar.isHigherVersion<0,8>() ) {
		SEISCOMP_ERROR("Archive version %d.%d too high: ConfigModule 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("parameterSetID", _parameterSetID, Archive::XML_ELEMENT);
	ar & NAMED_OBJECT_HINT("enabled", _enabled, Archive::XML_MANDATORY);
	if ( ar.hint() & Archive::IGNORE_CHILDS ) return;
	ar & NAMED_OBJECT_HINT("station",
	                       Seiscomp::Core::Generic::containerMember(_configStations,
	                       Seiscomp::Core::Generic::bindMemberFunction<ConfigStation>(static_cast<bool (ConfigModule::*)(ConfigStation*)>(&ConfigModule::add), this)),
	                       Archive::STATIC_TYPE);
}
Ejemplo n.º 22
0
  /*! @internal */
  template <class Archive, class T> inline
  void save( Archive & ar, memory_detail::PtrWrapper<std::shared_ptr<T> const &> const & wrapper )
  {
    auto & ptr = wrapper.ptr;

    uint32_t id = ar.registerSharedPointer( ptr.get() );
    ar( _CEREAL_NVP("id", id) );

    if( id & detail::msb_32bit )
    {
      ar( _CEREAL_NVP("data", *ptr) );
    }
  }
Ejemplo n.º 23
0
		void load(Archive & ar, const unsigned int version) {
				ar.register_type(static_cast<biexpTrans *>(NULL));
				ar.register_type(static_cast<flinTrans *>(NULL));
				ar.register_type(static_cast<logTrans *>(NULL));
				ar.register_type(static_cast<linTrans *>(NULL));
				if(version>1)
					ar.register_type(static_cast<scaleTrans *>(NULL));
				if(version>0){
					ar & BOOST_SERIALIZATION_NVP(globalBiExpTrans);
					ar & BOOST_SERIALIZATION_NVP(globalLinTrans);
				}


				ar & BOOST_SERIALIZATION_NVP(gTrans);
				ar & BOOST_SERIALIZATION_NVP(ghs);
				if(version<3)
				{
					unsigned short dMode;
					ar & BOOST_SERIALIZATION_NVP(dMode);
				}

		}
Ejemplo n.º 24
0
/* ArchiveManager::deleteBookmarksInDir
 * Removes any bookmarked entries in [node] from the list
 *******************************************************************/
bool ArchiveManager::deleteBookmarksInDir(ArchiveTreeNode* node)
{
	// Go through bookmarks
	Archive * archive = node->getArchive();
	bool removed = deleteBookmark(node->getDirEntry());
	for (unsigned a = 0; a < bookmarks.size(); ++a)
	{
		// Check bookmarked entry's parent archive
		if (bookmarks[a]->getParent() == archive)
		{
			// Now check if the bookmarked entry is within 
			// the removed dir or one of its descendants
			ArchiveTreeNode* anode = bookmarks[a]->getParentDir();
			bool remove = false;
			while (anode != archive->getRoot() && !remove)
			{
				if (anode == node)
					remove = true;
				else anode = (ArchiveTreeNode*)anode->getParent();
			}
			if (remove)
			{
				bookmarks.erase(bookmarks.begin() + a);
				--a;
				removed = true;
			}
		}
	}

	if (removed)
	{
		// Announce
		announce("bookmarks_changed");
		return true;
	}
	else
		return false;
}
Ejemplo n.º 25
0
void siconos_io_register_Kernel(Archive& ar)
{
  ar.register_type(static_cast<SimpleMatrix*>(NULL));
  ar.register_type(static_cast<SiconosVector*>(NULL));

  siconos_io_register_generated(ar);

  ar.register_type(static_cast<_DynamicalSystemsGraph*>(NULL));
  ar.register_type(static_cast<_InteractionsGraph*>(NULL));
  ar.register_type(static_cast<DynamicalSystemsSet*>(NULL));
  ar.register_type(static_cast<std::basic_ofstream<char>*>(NULL));

  //  ar.register_type(static_cast<PluginHandle*>(NULL));
  ar.register_type(static_cast<__mpz_struct*>(NULL));
  ar.register_type(static_cast<FrictionContact*>(NULL));
  ar.register_type(static_cast<LsodarOSI*>(NULL));


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

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

	ar & NAMED_OBJECT_HINT("network", _network, Archive::XML_MANDATORY);
	ar & NAMED_OBJECT_HINT("station", _station, Archive::XML_MANDATORY);
	ar & NAMED_OBJECT_HINT("timestamp", _timestamp, Archive::SPLIT_TIME | Archive::XML_MANDATORY);
	ar & NAMED_OBJECT_HINT("creationInfo", _creationInfo, Archive::STATIC_TYPE | Archive::XML_ELEMENT);
	if ( ar.hint() & Archive::IGNORE_CHILDS ) return;
	ar & NAMED_OBJECT_HINT("channel",
	                       Seiscomp::Core::Generic::containerMember(_envelopeChannels,
	                       Seiscomp::Core::Generic::bindMemberFunction<EnvelopeChannel>(static_cast<bool (Envelope::*)(EnvelopeChannel*)>(&Envelope::add), this)),
	                       Archive::STATIC_TYPE);
}
Ejemplo n.º 27
0
bool PythonSimScriptItem::restore(const Archive& archive)
{
    if(SimulationScriptItem::restore(archive)){
        string filename;
        if(archive.readRelocatablePath("file", filename)){
            if(load(filename)){
                if(impl->restore(archive)){
                    return true;
                }
            }
        }
    }
    return false;
}
Ejemplo n.º 28
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void Reading::serialize(Archive& ar) {
	// Do not read/write if the archive's version is higher than
	// currently supported
	if ( ar.isHigherVersion<0,11>() ) {
		SEISCOMP_ERROR("Archive version %d.%d too high: Reading skipped",
		               ar.versionMajor(), ar.versionMinor());
		ar.setValidity(false);
		return;
	}

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

	if ( ar.hint() & Archive::IGNORE_CHILDS ) return;
	ar & NAMED_OBJECT_HINT("pickReference",
	                       Seiscomp::Core::Generic::containerMember(_pickReferences,
	                       Seiscomp::Core::Generic::bindMemberFunction<PickReference>(static_cast<bool (Reading::*)(PickReference*)>(&Reading::add), this)),
	                       Archive::STATIC_TYPE);
	ar & NAMED_OBJECT_HINT("amplitudeReference",
	                       Seiscomp::Core::Generic::containerMember(_amplitudeReferences,
	                       Seiscomp::Core::Generic::bindMemberFunction<AmplitudeReference>(static_cast<bool (Reading::*)(AmplitudeReference*)>(&Reading::add), this)),
	                       Archive::STATIC_TYPE);
}
Ejemplo n.º 29
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void ResponseFIR::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: ResponseFIR skipped",
		               ar.versionMajor(), ar.versionMinor());
		ar.setValidity(false);
		return;
	}

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

	ar & NAMED_OBJECT_HINT("name", _index.name, Archive::INDEX_ATTRIBUTE);
	ar & NAMED_OBJECT_HINT("gain", _gain, Archive::XML_ELEMENT);
	ar & NAMED_OBJECT_HINT("decimationFactor", _decimationFactor, Archive::XML_ELEMENT);
	ar & NAMED_OBJECT_HINT("delay", _delay, Archive::XML_ELEMENT);
	ar & NAMED_OBJECT_HINT("correction", _correction, Archive::XML_ELEMENT);
	ar & NAMED_OBJECT_HINT("numberOfCoefficients", _numberOfCoefficients, Archive::XML_ELEMENT);
	ar & NAMED_OBJECT_HINT("symmetry", _symmetry, Archive::XML_ELEMENT);
	ar & NAMED_OBJECT_HINT("coefficients", _coefficients, Archive::STATIC_TYPE | Archive::XML_ELEMENT);
	ar & NAMED_OBJECT_HINT("remark", _remark, Archive::STATIC_TYPE | Archive::XML_ELEMENT);
}
Ejemplo n.º 30
0
Archive *Archive::create(const QString &fileName, const QString &fixedMimeType, QObject *parent)
{
    qCDebug(ARK) << "Going to create archive" << fileName;

    qRegisterMetaType<ArchiveEntry>("ArchiveEntry");

    PluginManager pluginManager;
    const QMimeType mimeType = fixedMimeType.isEmpty() ? determineMimeType(fileName) : QMimeDatabase().mimeTypeForName(fixedMimeType);

    const QVector<Plugin*> offers = pluginManager.preferredPluginsFor(mimeType);
    if (offers.isEmpty()) {
        qCCritical(ARK) << "Could not find a plugin to handle" << fileName;
        return new Archive(NoPlugin, parent);
    }

    Archive *archive;
    foreach (Plugin *plugin, offers) {
        archive = create(fileName, plugin, parent);
        // Use the first valid plugin, according to the priority sorting.
        if (archive->isValid()) {
            return archive;
        }
    }