本文整理汇总了C++中Archiver类的典型用法代码示例。如果您正苦于以下问题:C++ Archiver类的具体用法?C++ Archiver怎么用?C++ Archiver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Archiver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write
void PLCP::write(const string & filename){
Archiver arch;
arch.add_sp_mat("P",P);
arch.add_sp_mat("U",U);
arch.add_vec("q",q);
arch.write(filename);
}
示例2: Archive
void DefaultStrategos::Archive( Archiver &arc )
{
Strategos::Archive( arc );
arc.ArchiveFloat( &_checkYawMin );
arc.ArchiveFloat( &_checkYawMax );
arc.ArchiveFloat( &_checkInConeDistMax );
}
示例3: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Archiver w;
w.show();
return a.exec();
}
示例4: Archive
//
// Name: Archive()
// Parameters: Archiver &arc
// Description: Archives Class Data
//
void CombatSubsystem::Archive(Archiver& arc)
{
_activeWeapon.Archive(arc);
arc.ArchiveFloat(&_nextTimeTracedToTarget);
arc.ArchiveFloat(&_traceInterval);
arc.ArchiveBool(&_canShootTarget);
arc.ArchiveFloat(&_yawDiff);
}
示例5: Archive
inline void dfunction_t::Archive( Archiver &arc )
{
Class::Archive( arc );
arc.ArchiveInteger( &eventnum );
arc.ArchiveInteger( &first_statement );
arc.ArchiveInteger( &parm_start );
arc.ArchiveInteger( &parm_total );
arc.ArchiveInteger( &locals );
arc.ArchiveInteger( &profile );
arc.ArchiveString( &s_name );
arc.ArchiveString( &s_file );
arc.ArchiveInteger( &numparms );
arc.ArchiveInteger( &minparms );
if ( arc.Loading() )
{
memset( &parm_size, 0, sizeof( parm_size[0] ) * MAX_PARMS );
memset( &parm_type, 0, sizeof( parm_type[0] ) * MAX_PARMS );
}
arc.ArchiveRaw( parm_size, sizeof( parm_size[0] ) * numparms );
arc.ArchiveRaw( parm_type, sizeof( parm_type[0] ) * numparms );
}
示例6: new
Archiver* Archiver::create()
{
Archiver *ref = new (std::nothrow) Archiver();
if (ref) {
ref->autorelease();
return ref;
} else {
CC_SAFE_DELETE(ref);
return nullptr;
}
}
示例7: main
int main(int argc, char *argv[])
{
cout << "If you want to compress the file enter -zip" << endl <<
"If you want to uncompress the file enter -unzip" << endl << "Enter your choice:";
string command;
cin >> command;
if (command == "-zip")
{
cout << "Enter path of the origin..." << endl << "Enter the path:";
string pathOfOrigin;
cin >> pathOfOrigin;
string pathOfArchive = pathOfOrigin + ".myzip";
Archiver arch;
arch.compress(pathOfOrigin, pathOfArchive);
cout << "Done!" << endl;
}
示例8: Archive
inline void Talk::Archive(Archiver& arc) {
Behavior::Archive(arc);
arc.ArchiveObject(&turnto);
arc.ArchiveSafePointer(&ent_listening);
arc.ArchiveSafePointer(&last_headwatch_target);
arc.ArchiveFloat(&original_yaw);
arc.ArchiveFloat(&yaw);
arc.ArchiveInteger(&mode);
arc.ArchiveBoolean(&move_allowed);
arc.ArchiveBool(&animDone);
arc.ArchiveString(&oldAnimName);
}
示例9: normalize_output
//! Run through the data
void dsp::LoadToFold::finish () try
{
if (phased_filterbank)
{
cerr << "Calling PhaseLockedFilterbank::normalize_output" << endl;
phased_filterbank -> normalize_output ();
}
SingleThread::finish();
if (!output_subints())
{
if (!unloader.size())
throw Error (InvalidState, "dsp::LoadToFold::finish", "no unloader");
for (unsigned i=0; i<fold.size(); i++)
{
Archiver* archiver = dynamic_cast<Archiver*>( unloader[0].get() );
if (!archiver)
throw Error (InvalidState, "dsp::LoadToFold::finish",
"unloader is not an archiver (single integration)");
/*
In multi-threaded applications, the thread that calls the
finish method may not be the thread that called the prepare
method.
*/
if (Operation::verbose)
cerr << "Creating archive " << i+1 << endl;
if (phased_filterbank)
archiver->unload( phased_filterbank->get_output() );
else
archiver->unload( fold[i]->get_result() );
}
}
}
catch (Error& error)
{
throw error += "dsp::LoadToFold::finish";
}
示例10: Archive
//
// Name: Archive()
// Parameters: Archiver &arc -- The archiver object
// Description: Archives the class
//
void SensoryPerception::Archive ( Archiver &arc )
{
arc.ArchiveInteger ( &_stimuli );
arc.ArchiveInteger ( &_permanent_stimuli );
arc.ArchiveVector ( &_noise_position );
arc.ArchiveInteger ( &_last_soundType );
arc.ArchiveFloat ( &_noise_time );
arc.ArchiveFloat ( &_fov );
arc.ArchiveFloat ( &_fovdot );
arc.ArchiveFloat ( &_vision_distance );
arc.ArchiveFloat ( &_nextSenseTime );
arc.ArchiveInteger( &_lineOfSight.entNum );
arc.ArchiveFloat( &_lineOfSight.time );
arc.ArchiveBoolean( &_lineOfSight.inLineOfSight );
}
示例11: Archive
//--------------------------------------------------------------
// Name: Archive()
// Class: PostureController
//
// Description: Archives the class
//
// Parameters: Archiver &arc
//
// Returns: None
//--------------------------------------------------------------
void PostureController::Archive( Archiver &arc )
{
arc.ArchiveString( &_postureStateMap_Name );
arc.ArchiveString( &_currentPostureState_Name );
arc.ArchiveString( &_requestedPostureState_Name );
arc.ArchiveSafePointer ( &_requestor );
if ( !arc.Saving() )
{
if ( _postureStateMap_Name.length() )
{
Event *event;
event = new Event( EV_Actor_SetPostureStateMap );
event->AddString( _postureStateMap_Name );
event->AddInteger( 1 );
act->ProcessEvent ( event );
_currentPostureState = _postureStateMap->FindState( _currentPostureState_Name.c_str() );
_requestedPostureState = _postureStateMap->FindState(_requestedPostureState_Name.c_str() );
}
}
}
示例12: Archive
void Entity::Archive( Archiver &arc )
{
SimpleEntity::Archive( arc );
arc.ArchiveBoolean( &fShader );
if( fShader )
{
arc.ArchiveString( &shader );
if( arc.Loading() ) {
customshader = cgi.R_RegisterShader( shader );
}
}
arc.ArchiveBoolean( &canThink );
arc.ArchiveFloat( &scale );
arc.ArchiveInteger( &entnum );
arc.ArchiveInteger( &renderFx );
arc.ArchiveString( &model );
}
示例13: createStaticLibrary
void createStaticLibrary(CCompiler<Base>& compiler,
Archiver& ar,
bool posIndepCode) {
// backup output format so that it can be restored
OStreamConfigRestore coutb(std::cout);
this->modelLibraryHelper_->startingJob("", JobTimer::STATIC_MODEL_LIBRARY);
const std::map<std::string, ModelCSourceGen<Base>*>& models = this->modelLibraryHelper_->getModels();
try {
for (const auto& p : models) {
const std::map<std::string, std::string>& modelSources = this->getSources(*p.second);
this->modelLibraryHelper_->startingJob("", JobTimer::COMPILING_FOR_MODEL);
compiler.compileSources(modelSources, posIndepCode, this->modelLibraryHelper_);
this->modelLibraryHelper_->finishedJob();
}
const std::map<std::string, std::string>& sources = this->getLibrarySources();
compiler.compileSources(sources, posIndepCode, this->modelLibraryHelper_);
const std::map<std::string, std::string>& customSource = this->modelLibraryHelper_->getCustomSources();
compiler.compileSources(customSource, posIndepCode, this->modelLibraryHelper_);
std::string libname = _libraryName;
if (_customLibExtension != nullptr)
libname += *_customLibExtension;
else
libname += system::SystemInfo<>::STATIC_LIB_EXTENSION;
ar.create(libname, compiler.getObjectFiles(), this->modelLibraryHelper_);
} catch (...) {
compiler.cleanup();
throw;
}
compiler.cleanup();
this->modelLibraryHelper_->finishedJob();
}
示例14: main
int main(int argc, char** argv)
{
po::variables_map var_map = read_command_line(argc,argv);
string mesh_file = var_map["infile_base"].as<string>() + ".tri";
// Read in the CGAL mesh
TriMesh mesh;
cout << "Reading in cgal mesh file [" << mesh_file << ']' << endl;
mesh.read_cgal(mesh_file);
mesh.freeze();
uint V = mesh.number_of_vertices();
uint N = mesh.number_of_all_nodes();
assert(N == V+1);
uint F = mesh.number_of_faces();
cout << "Mesh stats:"
<< "\n\tNumber of vertices: " << V
<< "\n\tNumber of faces: " << F
<< endl;
Points centers = mesh.get_cell_centers();
// Find boundary from the mesh and create the simulator object
mat bbox = mesh.find_bounding_box();
vec lb = bbox.col(0);
vec ub = bbox.col(1);
cout << "\tLower bound:" << lb.t()
<< "\tUpper bound:" << ub.t();
// Read in solution information
string soln_file = var_map["infile_base"].as<string>() + ".sol";
cout << "Reading in LCP solution file [" << soln_file << ']' << endl;
Unarchiver sol_unarch(soln_file);
vec p = sol_unarch.load_vec("p");
string lcp_file = var_map["infile_base"].as<string>() + ".lcp";
Unarchiver lcp_unarch(lcp_file);
vec q = lcp_unarch.load_vec("q");
Archiver arch;
// Make sure that the primal information makes sense
assert(0 == p.n_elem % V);
uint A = p.n_elem / V;
assert(A == 3);
cout << "Blocking primal solution..."
<< "\n\tLength of primal solution: " << p.n_elem
<< "\n\tRatio of primal length to vertex number: " << A << endl;
mat P = reshape(p,size(V,A));
P = join_vert(P,datum::inf * ones<rowvec>(3)); // Pad
vec value = P.col(0);
mat flows = P.tail_cols(2);
mat Q = reshape(q,size(V,A));
Q = join_vert(Q,datum::inf * ones<rowvec>(3)); // Pad
vec recon_b = mesh.interpolate(centers,
conv_to<vec>::from(Q.col(1)));
vec recon_c = mesh.interpolate(centers,
conv_to<vec>::from(Q.col(2)));
arch.add_vec("recon_b",recon_b);
arch.add_vec("recon_c",recon_c);
vec area = mesh.cell_area();
arch.add_vec("area",area);
// True values
vec sq_dist = sum(pow(centers,2),1);
vec b = sq_dist;
vec c = max(zeros<vec>(F),1 - sq_dist);
vec x = arma::min(b,c);
assert(all(x >= 0));
assert(F == x.n_elem);
uvec pi = arma::index_min(join_horiz(b,c),1);
assert(F == pi.n_elem);
arch.add_uvec("pi",pi);
// Approx policy
assert(2 == flows.n_cols);
mat interp_flows = mesh.interpolate(centers,flows);
uvec flow_pi = arma::index_max(interp_flows,1);
arch.add_uvec("flow_pi",flow_pi);
assert(F == flow_pi.n_elem);
uvec diff = zeros<uvec>(F);
diff(find(flow_pi != pi)).fill(1);
arch.add_uvec("policy_diff",diff);
// Approx value
vec interp_value = mesh.interpolate(centers,value);
assert(F == interp_value.n_elem);
vec res = abs(x - interp_value);
arch.add_vec("residual",res);
vec heuristic = res;
heuristic(find(flow_pi != pi)) *= 4;
arch.add_vec("heuristic",heuristic);
double quant = 0.9;
cout << "Quantile:" << quant << endl;
//.........这里部分代码省略.........
示例15: write
void SolverResult::write(const string & filename) const{
Archiver arch;
arch.add_vec("p",p);
arch.add_vec("d",d);
arch.write(filename);
}