void SceneManagement::saveMinSGStream(SceneManager & sm, std::ostream & out, const std::deque<Node *> & nodes) { if(!out.good()) throw std::runtime_error("Cannot save MinSG nodes to the given stream."); ExporterContext ctxt(sm); std::unique_ptr<DescriptionMap> description(ExporterTools::createDescriptionForScene(ctxt, nodes)); if(!WriterMinSG::save(out, *(description.get()))) throw std::runtime_error("Could not serialize MinSG nodes."); }
void PlanarPortal::serialize( std::ostream& output_stream ) const { assert( output_stream.good() ); m_plane_a.serialize( output_stream ); m_plane_b.serialize( output_stream ); Utilities::serialize( m_v, output_stream ); Utilities::serialize( m_bounds, output_stream ); Utilities::serialize( m_dx, output_stream ); }
bool EdgeSE3PointXYZ::write(std::ostream& os) const { os << offsetParam->id() << " "; for (int i=0; i<3; i++) os << measurement()[i] << " "; for (int i=0; i<information().rows(); i++) for (int j=i; j<information().cols(); j++) { os << information()(i,j) << " "; } return os.good(); }
bool EdgeSE2::write(std::ostream& os) const { Vector3 p = measurement().toVector(); os << p.x() << " " << p.y() << " " << p.z(); for (int i = 0; i < 3; ++i) for (int j = i; j < 3; ++j) os << " " << information()(i, j); return os.good(); }
bool EdgePointXY::write(std::ostream& os) const { Vector2d p = measurement(); os << p.x() << " " << p.y(); for (int i = 0; i < 2; ++i) for (int j = i; j < 2; ++j) os << " " << information()(i, j); return os.good(); }
bool encode(std::ostream& os, const ::mfast::aggregate_cref& msg, unsigned json_object_tag_mask, unsigned ignore_tag_mask) { encode_detail::json_visitor_with_ignore_tag visitor(os, json_object_tag_mask, ignore_tag_mask); visitor.visit(msg, 0); return os.good(); }
bool EdgeSE3::write(std::ostream& os) const { Vector7d meas=toVectorQT(_measurement); for (int i=0; i<7; i++) os << meas[i] << " "; for (int i=0; i<information().rows(); i++) for (int j=i; j<information().cols(); j++) { os << information()(i,j) << " "; } return os.good(); }
bool EdgeLine2D::write(std::ostream& os) const { for (int i = 0; i < 2; ++i) os << _measurement[i] << " "; for (int i = 0; i < 2; ++i) for (int j = i; j < 2; ++j) os << " " << information()(i, j); return os.good(); }
// ================================================ bool EdgeSE3Switchable::write(std::ostream& os) const { g2o::Vector7d meas = g2o::internal::toVectorQT(measurement()); for (int i=0; i<7; i++) os << meas[i] << " "; for (int i = 0; i < 6; ++i) for (int j = i; j < 6; ++j) os << " " << information()(i, j); return os.good(); }
bool EdgeSE2Segment2DLine::write(std::ostream& os) const { for (size_t i = 0; i < 2 ; i++) os << _measurement[i] << " "; for (size_t i = 0; i < 2 ; i++) for (size_t j = i; j < 2 ; j++) { os << _information (i,j) << " "; } return os.good(); }
void GeometricImpactFrictionMap::serialize( std::ostream& output_stream ) const { assert( output_stream.good() ); MathUtilities::serialize( m_f, output_stream ); Utilities::serialize( m_abs_tol, output_stream ); Utilities::serialize( m_max_iters, output_stream ); Utilities::serialize( m_impulses_to_cache, output_stream ); assert( m_write_constraint_forces == false ); assert( m_constraint_force_stream == nullptr ); }
bool EdgePlane::write(std::ostream& os) const { int size=4; for (int i = 0; i < size; ++i) os << _measurement[i] << " "; for (int i = 0; i < size; ++i) for (int j = i; j < size; ++j) os << " " << information()(i, j); return os.good(); }
void Utilities::serialize<bool>( const std::vector<bool>& vector, std::ostream& output_stream ) { assert( output_stream.good() ); serialize( vector.size(), output_stream ); for( std::vector<bool>::size_type idx = 0; idx < vector.size(); ++idx ) { const bool local_val = vector[idx]; serialize( local_val, output_stream ); } }
bool EdgeSE3PlaneSensorCalib::write(std::ostream& os) const { Vector4D v = _measurement.toVector(); os << v(0) << " " << v(1) << " " << v(2) << " " << v(3) << " "; os << color(0) << " " << color(1) << " " << color(2) << " "; for (int i = 0; i < information().rows(); ++i) for (int j = i; j < information().cols(); ++j) os << " " << information()(i, j); return os.good(); }
void Memory::save( std::ostream& stream, const unsigned int& startPos, const unsigned int& length ) throw ( std::invalid_argument ) { if ( startPos >= m_size ) throw std::invalid_argument("Memory::save(): startPos >= m_size"); unsigned int stopPos = std::min(m_size-1, startPos+length); for ( unsigned int i = startPos; i <= stopPos; i++ ) { if (!stream.good()) break; stream.put(data[i]); } }
bool ParameterCamera::write(std::ostream& os) const { Vector7d off = offset().toVector(); for (int i=0; i<7; i++) os << off[i] << " "; os << _Kcam(0,0) << " "; os << _Kcam(1,1) << " "; os << _Kcam(0,2) << " "; os << _Kcam(1,2) << " "; return os.good(); }
bool EdgeSE3Offset::write(std::ostream& os) const { os << _offsetFrom->id() << " " << _offsetTo->id() << " "; Vector7d meas=internal::toVectorQT(_measurement); for (int i=0; i<7; i++) os << meas[i] << " "; for (int i=0; i<information().rows(); i++) for (int j=i; j<information().cols(); j++) { os << information()(i,j) << " "; } return os.good(); }
bool EdgeSE3Expmap::write(std::ostream& os) const { SE3Quat cam2world(measurement().inverse()); for (int i=0; i<7; i++) os << cam2world[i] << " "; for (int i=0; i<6; i++) for (int j=i; j<6; j++) { os << " " << information()(i,j); } return os.good(); }
bool EdgePointPlane3d::write(std::ostream &os) const { os << measurement() << " "; for (int i = 0; i < information().rows(); i++) for (int j = i; j < information().cols(); j++) os << information()(i, j) << " "; return os.good(); }
bool c8bppBitmap::saveTo(std::ostream &file) { if (!m_PixelData) return false; if (file.good()) file.write((char*)m_PixelData, m_Width * m_Height); return !file.bad(); }
int CsoundFile::exportArrangement(std::ostream &stream) const { for(std::vector<std::string>::const_iterator it = arrangement.begin(); it != arrangement.end(); ++it) { stream << (*it).c_str() << std::endl; } return stream.good(); }
/*------------------------------------- Saving a functor to an output stream -------------------------------------*/ bool Functor::save(std::ostream& ostr) const { if (pNextFunc == nullptr) { ostr << 0 << ' ' << 0; } else { ostr << pNextFunc->get_script_subtype() << ' ' << (void*)pNextFunc; } return ostr.good(); }
bool exportToGraphvizFormat_Image( const GraphT & g, const NodeMap & nodeMap, const EdgeMap & edgeMap, std::ostream & os, bool bWeightedEdge = false) { os << "graph 1 {" << std::endl; os << "node [shape=none]" << std::endl; //Export node label for(typename GraphT::NodeIt n(g); n!=lemon::INVALID; ++n) { os << " n" << g.id(n) << "[ label =" << "< "<< std::endl << "<table>" << std::endl << "<tr><td>" << "\"" << nodeMap[n] << "\"" << "</td></tr>" << std::endl << "<tr><td><img src=\"" << nodeMap[n] << "\"/></td></tr>" << std::endl << "</table>" << std::endl << ">, cluster=1];" << std::endl; //os << " n" << g.id(n) // << " [ " // << " image=\"" << nodeMap[n] << "\" cluster=1]; " << endl; } //Export arc value std::map< std::pair<IndexT, IndexT>, IndexT > map_arcs; for(typename GraphT::ArcIt e(g); e!=lemon::INVALID; ++e) { if( map_arcs.end() == map_arcs.find(std::make_pair(IndexT(g.id(g.source(e))), IndexT(g.id(g.target(e))))) && map_arcs.end() == map_arcs.find(std::make_pair(IndexT(g.id(g.target(e))), IndexT(g.id(g.source(e)))))) { map_arcs[std::make_pair(IndexT(g.id(g.source(e))), IndexT(g.id(g.target(e)))) ] = edgeMap[e]; } } os << "edge [style=bold]" << std::endl; for ( std::map< std::pair<IndexT,IndexT>, IndexT>::const_iterator iter = map_arcs.begin(); iter != map_arcs.end(); ++iter) { if (bWeightedEdge) { os << " n" << iter->first.first << " -- " << " n" << iter->first.second << " [label=\"" << iter->second << "\"]" << std::endl; } else { os << " n" << iter->first.first << " -- " << " n" << iter->first.second << std::endl; } } os << "}" << std::endl; return os.good(); }
bool EdgeProjectXYZ2UVU::write(std::ostream& os) const { for (int i=0; i<3; i++) { os << measurement()[i] << " "; } for (int i=0; i<3; i++) for (int j=i; j<3; j++) { os << " " << information()(i,j); } return os.good(); }
bool EdgeInverseSim3ProjectXYZ::write(std::ostream &os) const { for (int i = 0; i < 2; i++) { os << _measurement[i] << " "; } for (int i = 0; i < 2; i++) for (int j = i; j < 2; j++) { os << " " << information()(i, j); } return os.good(); }
// TODO: This constructor should use the utility functions to serialize void StabilizedImpactFrictionMap::serialize( std::ostream& output_stream ) const { assert( output_stream.good() ); MathUtilities::serialize( m_f, output_stream ); output_stream.write( (char*) &m_abs_tol, sizeof(scalar) ); output_stream.write( (char*) &m_max_iters, sizeof(unsigned) ); output_stream.write( (char*) &m_write_constraint_forces, sizeof(bool) ); assert( m_constraint_force_stream == nullptr ); }
bool ParameterStereoCamera::write(std::ostream& os) const { Vector7 off = internal::toVectorQT(_offset); for (int i=0; i<7; i++) os << off[i] << " "; os << _Kcam(0,0) << " "; os << _Kcam(1,1) << " "; os << _Kcam(0,2) << " "; os << _Kcam(1,2) << " "; os << baseline() << " "; return os.good(); }
bool EdgePointXYZCovPointXYZCov::write(std::ostream& os) const { /** the measurement should always be 0,0,0 and the information matrix is computed in computeError() */ // for (int i=0; i<3; i++) // os << measurement()[i] << " "; // for (int i=0; i<3; i++) // for (int j=i; j<3; j++){ // os << " " << information()(i,j); // } return os.good(); }
//TODO: implement, but first remove camera parameters from vertex state bool G2oVertexSE3 ::write(std::ostream& os) const { std::cout << "write G2oVertexSE3 called" << "\n"; const Sophus::SE3 & se3 = _estimate; const Vector3d & vec = se3.translation(); for(int i=0; i<3; i++) os << vec[i] << " "; const Quaterniond & q = se3.unit_quaternion(); os << q.x() << " " << q.y() << " " << q.z() << " " << q.w(); return os.good(); }
bool EdgeProjectPSI2UV::write(std::ostream& os) const { os << _cam->id() << " "; for (int i=0; i<2; i++) { os << measurement()[i] << " "; } for (int i=0; i<2; i++) for (int j=i; j<2; j++) { os << " " << information()(i,j); } return os.good(); }