text
stringlengths 5
1.04M
|
|---|
#ifndef _CHANGEBASE_HPP
#define _CHANGEBASE_HPP
#include "bind/bindedfunc.hpp"
#include "dot.hpp"
namespace vind
{
namespace core
{
class NTypeLogger ;
class CharLogger ;
}
namespace bind
{
struct ChangeBase : public BindedFunc {
template <typename String>
explicit ChangeBase(String&& name)
: BindedFunc(std::forward<String>(name))
{}
} ;
template <typename Derived>
class ChangeBaseCreator : public ChangeBase {
private:
SystemCall do_process() override {
static_cast<Derived*>(this)->sprocess() ;
return SystemCall::NOTHING ;
}
SystemCall do_process(core::NTypeLogger& parent_lgr) override {
static_cast<Derived*>(this)->sprocess(parent_lgr) ;
RepeatLastChange::store_change(this) ;
return SystemCall::NOTHING ;
}
SystemCall do_process(const core::CharLogger& parent_lgr) override {
static_cast<Derived*>(this)->sprocess(parent_lgr) ;
RepeatLastChange::store_change(this) ;
return SystemCall::NOTHING ;
}
public:
template <typename String>
explicit ChangeBaseCreator(String&& name)
: ChangeBase(std::forward<String>(name))
{}
static std::unique_ptr<BindedFunc> create() {
return std::make_unique<Derived>() ;
}
} ;
} // namespace bind
} // namespace vind
#endif
|
// -*-Mode: C++;-*-
/* ---------------------------------------------------------------------- *//*!
*
* @file DataFragment.cc
* @brief Access methods for the RCE data fragments
* decoding a binary test file.
* @verbatim
* Copyright 2017
* by
*
* The Board of Trustees of the
* Leland Stanford Junior University.
* All rights reserved.
*
* @endverbatim
*
\* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- *\
HISTORY
-------
DATE WHO WHAT
---------- --- ---------------------------------------------------------
2017.10.07 jjr Created
\* ---------------------------------------------------------------------- */
#define DATAFRAGMENT_IMPL extern
#include "DataFragment-Impl.hh"
#include <cinttypes>
#include <cstdio>
namespace pdd {
namespace access {
/* ---------------------------------------------------------------------- *//*!
\brief Constructor to populate pointers to the various subrecords of a
data fragment
\param[in] buf The ProtoDune data buffer. This must have been
verified as a ProtoDune data.
*/
/* ---------------------------------------------------------------------- */
DataFragment::DataFragment (uint64_t const *buf) :
m_buf (buf),
m_originator (getOriginator (buf)),
m_data (getData (buf)),
m_trailer (getTrailer (buf))
{
return;
}
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- *//*!
\brief Prints all or portions of the Data Fragment's subrecords
*/
/* ---------------------------------------------------------------------- */
void DataFragment::print () const
{
printHeader ();
printIdentifier ();
printOriginator ();
printData ();
return;
}
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- *//*!
\brief Print the Data Fragment Header
*/
/* ---------------------------------------------------------------------- */
void DataFragment::printHeader () const
{
pdd::Header0 const *hdr = getHeader ();
print (hdr);
return;
}
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- *//*!
\brief Print's a generic Fragment Header interpretted as a
Data Fragment Header.
\param[in] header The generic Fragment Header.
*/
/* ---------------------------------------------------------------------- */
void DataFragment::print (pdd::Header0 const *header)
{
printf ("Header: %16.16" PRIx64 "\n", header->retrieve());
unsigned int format = header->getFormat ();
unsigned int type = header->getType ();
unsigned int n64 = header->getN64 ();
unsigned int naux64 = header->getNaux64 ();
unsigned int subtype = header->getSubtype ();
unsigned int bridge = header->getBridge ();
printf ("Header Type.Format = %1.1x.%1.1x "
"N64:%6.6x:%1.1x SubType=%1.1x Bridge=%6.6x\n",
type,format,
n64, naux64,
subtype, bridge);
}
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- *//*!
\brief Print the Identifier record
*/
/* ---------------------------------------------------------------------- */
void DataFragment::printIdentifier () const
{
pdd::access::Identifier const id (getIdentifier ());
id.print ();
return;
}
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- *//*!
\brief Print the Originator record
*/
/* ---------------------------------------------------------------------- */
void DataFragment::printOriginator () const
{
pdd::access::Originator const org (getOriginator ());
org.print ();
return;
}
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- *//*!
\brief Print some portion of Data record
\par
Since the Data record is potentially very large, only the meta-data
and some limited piece of the actual TPC data is printed. There
really is no way to provide a generic print routine that will satisfy
the needs in all or even most circumstances, so this is meant more as
a first level, get off-the-ground method.
*/
/* ---------------------------------------------------------------------- */
void DataFragment::printData () const
{
pdd::access::Data const data (getData ());
data.print ();
}
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- *//*!
\brief Print the Trailer record
*/
/* ---------------------------------------------------------------------- */
void DataFragment::printTrailer () const
{
pdd::Trailer const *tlr = getTrailer ();
print (tlr);
return;
}
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- *//*!
\brief Print the Trailer record
\param[in] trailer Pointer to the trailer record.
*/
/* ---------------------------------------------------------------------- */
void DataFragment::print (pdd::Trailer const *trailer)
{
printf ("Trailer = %16.16" PRIx64 "\n", trailer->retrieve ());
return;
}
/* ---------------------------------------------------------------------- */
} /* END: namespace access */
/* ---------------------------------------------------------------------- */
} /* END: namespace pdd */
/* ====================================================================== */
|
//Copyright(c) 2016 Shuda Li[lishuda1980@gmail.com]
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files(the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions :
//
//The above copyright notice and this permission notice shall be included in
//all copies or substantial portions of the Software.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
//FOR A PARTICULAR PURPOSE AND NON - INFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR
//COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
//
#ifndef BTL_CONVERTER_HEADER
#define BTL_CONVERTER_HEADER
#define CV_SSE2 1
#include "OtherUtil.hpp"
#include <opencv/highgui.h>
#include <opencv/cv.h>
#include <Eigen/Dense>
// ====================================================================
// === Implementation
namespace btl
{
namespace utility
{
//for print
/*template <class T>
std::ostream& operator << ( std::ostream& os, const cv::Size_< T >& s )
{
os << "[ " << s.width << ", " << s.height << " ]";
return os;
}*/
template < class T, int ROW >
std::vector< T >& operator << ( std::vector< T >& vVec_, const Eigen::Matrix< T, ROW, 1 >& eiVec_ )
{
vVec_.clear();
for ( int r = 0; r < ROW; r++ )
{
vVec_.push_back ( eiVec_ ( r, 0 ) );
}
return vVec_;
}
template < class T, int ROW >
const Eigen::Matrix< T, ROW, 1 >& operator >> ( const Eigen::Matrix< T, ROW, 1 >& eiVec_, std::vector< T >& vVec_ )
{
vVec_ << eiVec_;
}
template < class T >
Eigen::Matrix< T, Eigen::Dynamic, 1 >& operator << ( Eigen::Matrix< T, Eigen::Dynamic, 1 >& eiVec_, const std::vector< T >& vVec_ )
{
if ( vVec_.empty() )
{
eiVec_.resize ( 0, 0 );
}
else
{
eiVec_.resize ( vVec_.size(), 1 );
}
for ( int r = 0; r < vVec_.size(); r++ )
{
eiVec_ ( r, 0 ) = vVec_[r];
}
return eiVec_;
}
template < class T >
Eigen::Matrix< T, Eigen::Dynamic, 1 >& operator << ( Eigen::Matrix< T, Eigen::Dynamic, 1 >& eiVec_, const cv::Mat& cvmVec_ )
{
if ( cvmVec_.empty() ){
eiVec_.resize ( 0, 0 );
}
else{
eiVec_.resize ( cvmVec_.rows, 1 );
}
const T* p = (const T*)cvmVec_.data;
for ( int r = 0; r < cvmVec_.rows; r++ ){
eiVec_ ( r, 0 ) = *p;
p ++;
}
return eiVec_;
}
template < class T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic >& operator << ( Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic >& eiMat_, const cv::Mat& cvmMat_ )
{
if ( cvmMat_.empty() ){
eiMat_.resize ( 0, 0 );
}
else{
eiMat_.resize ( cvmMat_.rows, cvmMat_.cols );
}
for ( int r = 0; r < cvmMat_.rows; r++ ){
for ( int c = 0; c < cvmMat_.cols; c++ ){
eiMat_ ( r, c ) = cvmMat_.template at< T > ( r , c );
}
}
return eiMat_;
}
template < class T >
const std::vector< T >& operator >> ( const std::vector< T >& vVec_, Eigen::Matrix< T, Eigen::Dynamic, 1 >& eiVec_ )
{
eiVec_ << vVec_;
}
template < class T, int ROW >
Eigen::Matrix< T, ROW, 1 >& operator << ( Eigen::Matrix< T, ROW, 1 >& eiVec_, const std::vector< T >& vVec_ )
{
CHECK ( eiVec_.rows() == vVec_.size(), "Eigen::Vector << std::vector wrong!" );
for ( int r = 0; r < vVec_.size(); r++ )
{
eiVec_ ( r, 0 ) = vVec_[r];
}
return eiVec_;
}
template < class T, int ROW >
void operator >> ( const std::vector< T >& vVec_, Eigen::Matrix< T, ROW, 1 >& eiVec_ )
{
eiVec_ << vVec_;
}
/*template < class T>
std::*/
template < class T, int ROW, int COL >
std::vector< std::vector< T > >& operator << ( std::vector< std::vector< T > >& vvVec_, const Eigen::Matrix< T, ROW, COL >& eiMat_ )
{
vvVec_.clear();
for ( int r = 0; r < ROW; r++ )
{
std::vector< T > v;
for ( int c = 0; c < COL; c++ )
{
v.push_back ( eiMat_ ( r, c ) );
}
vvVec_.push_back ( v );
}
return vvVec_;
}
template < class T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic >& operator << ( Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic >& eiMat_, const std::vector< std::vector< T > >& vvVec_ )
{
if ( vvVec_.empty() )
{
eiMat_.resize ( 0, 0 );
}
else
{
eiMat_.resize ( vvVec_.size(), vvVec_[0].size() );
}
for ( int r = 0; r < vvVec_.size(); r++ )
for ( int c = 0; c < vvVec_[r].size(); c++ )
{
eiMat_ ( r, c ) = vvVec_[r][c];
}
return eiMat_;
}
template < class T , int ROW, int COL>
Eigen::Matrix< T, ROW, COL >& operator << ( Eigen::Matrix< T, ROW, COL >& eiMat_, const std::vector< std::vector< T > >& vvVec_ )
{
if ( ROW != vvVec_.size() )
{
CError cE;
cE << CErrorInfo ( " std::vector< std::vector<> > is inconsistent with ROW of Matrix. \n" );
throw cE;
}
else if ( COL != vvVec_[0].size() )
{
CError cE;
cE << CErrorInfo ( " std::vector<> is inconsistent with COL of Matrix. \n" );
throw cE;
}
for ( int r = 0; r < vvVec_.size(); r++ )
for ( int c = 0; c < vvVec_[r].size(); c++ )
{
eiMat_ ( r, c ) = vvVec_[r][c];
}
return eiMat_;
}
template <class T>
std::vector< T >& operator << ( std::vector< T >& vVec_, const cv::Point3_< T >& cvPt_ )
{
vVec_.clear();
vVec_.push_back ( cvPt_.x );
vVec_.push_back ( cvPt_.y );
vVec_.push_back ( cvPt_.z );
return vVec_;
}
template <class T>
cv::Point3_< T >& operator << ( cv::Point3_< T >& cvPt_, const std::vector< T >& vVec_ )
{
if ( vVec_.empty() )
{
cvPt_.x = cvPt_.y = cvPt_.z = 0;
}
else if ( 3 != vVec_.size() )
{
CError cE;
cE << CErrorInfo ( " std::vector<> is inconsistent with cv::Point3_. \n" );
throw cE;
}
else
{
cvPt_.x = vVec_[0];
cvPt_.y = vVec_[1];
cvPt_.z = vVec_[2];
}
return cvPt_;
}
//vector -> cv::Point_
template <class T>
cv::Point_< T >& operator << ( cv::Point_< T >& cvPt_, const std::vector< T >& vVec_ )
{
if ( vVec_.empty() )
{
cvPt_.x = cvPt_.y = 0;
}
else if ( 2 != vVec_.size() )
{
CError cE;
cE << CErrorInfo ( " std::vector<> is inconsistent with cv::Point3_. \n" );
throw cE;
}
else
{
cvPt_.x = vVec_[0];
cvPt_.y = vVec_[1];
}
return cvPt_;
}
//Point_ -> std::vector
template <class T>
std::vector< T >& operator << ( std::vector< T >& vVec_, const cv::Point_< T >& cvPt_ )
{
vVec_.clear();
vVec_.push_back ( cvPt_.x );
vVec_.push_back ( cvPt_.y );
return vVec_;
}
template < class T, int ROW, int COL >
Eigen::Matrix< T, ROW, COL >& operator << ( Eigen::Matrix< T, ROW, COL >& eiVec_, const cv::Mat_< T >& cvVec_ )
{
if ( ROW != cvVec_.rows || COL != cvVec_.cols )
{
CError cE;
cE << CErrorInfo ( " cv::Mat dimension is inconsistent with Vector3d . \n" );
//PRINT( cvVec_.cols ); PRINT( cvVec_.rows );
throw cE;
}
for ( int r = 0; r < ROW; r++ )
for ( int c = 0; c < COL; c++ )
{
eiVec_ ( r, c ) = cvVec_.template at< T > ( r, c );
}
return eiVec_;
}
// 4.1 std::vector -> cv::Mat_ -> std::vector
template < class T >
std::vector< std::vector< T > >& operator << ( std::vector< std::vector< T > >& vvVec_, const cv::Mat_< T >& cvMat_ )
{
vvVec_.clear();
for ( int r = 0; r < cvMat_.rows; r++ )
{
std::vector< T > v;
for ( int c = 0; c < cvMat_.cols; c++ )
{
v.push_back ( cvMat_.template at< T > ( r, c ) );
}
vvVec_.push_back ( v );
}
return vvVec_;
}
template < class T >
cv::Mat_< T >& operator << ( cv::Mat_< T >& cvMat_, const std::vector< T >& vVec_ )
{
if ( vVec_.empty() )
{
CError cE;
cE << CErrorInfo ( " the input std::vector<> cannot be empty.\n" );
throw cE;
}
cvMat_.create ( ( int ) vVec_.size(), 1 );
for ( int r = 0; r < ( int ) vVec_.size(); r++ )
{
cvMat_.template at< T > ( r, 0 ) = vVec_[r];
}
return cvMat_;
}
template < class T >
void operator >> ( const std::vector< T >& vVec_, cv::Mat_< T >& cvMat_ )
{
cvMat_ << vVec_;
}
template < class T >
void operator << ( std::vector< T >& vVec_, const cv::Mat_< T >& cvMat_ )
{
vVec_.clear();
for ( int r = 0; r < ( int ) cvMat_.rows*cvMat_.cols; r++ )
{
vVec_.push_back( cvMat_.template at< T > ( r, 0 ) );
}
}
template < class T >
void operator >> ( const cv::Mat_< T >& cvMat_, std::vector< T >& vVec_ )
{
vVec_ << cvMat_;
}
template < class T >
cv::Mat_< T >& operator << ( cv::Mat_< T >& cvMat_, const std::vector< std::vector< T > >& vvVec_ )
{
if ( vvVec_.empty() || vvVec_[0].empty() )
{
CError cE;
cE << CErrorInfo ( " the input std::vector<> cannot be empty.\n" );
throw cE;
}
cvMat_.create ( ( int ) vvVec_.size(), ( int ) vvVec_[0].size() );
for ( int r = 0; r < ( int ) vvVec_.size(); r++ )
{
for ( int c = 0; c < vvVec_[r].size(); c++ )
{
cvMat_.template at< T > ( r, c ) = vvVec_[r][c];
}
}
return cvMat_;
}
template < class T >
std::vector< std::vector< std::vector< T > > >& operator << ( std::vector< std::vector< std::vector< T > > >& vvvVec_, const std::vector< cv::Mat_< T > >& vmMat_ )
{
vvvVec_.clear();
typename std::vector< cv::Mat_< T > >::const_iterator constItr = vmMat_.begin();
for ( ; constItr != vmMat_.end(); ++constItr )
{
std::vector< std::vector< T > > vv;
vv << ( *constItr );
vvvVec_.push_back ( vv );
}
return vvvVec_;
}
template < class T >
std::vector< std::vector< std::vector< T > > >& operator << ( std::vector< std::vector< std::vector< T > > >& vvvVec_, const std::vector< cv::Mat >& vmMat_ )
{
std::vector< cv::Mat_< T > > vmTmp;
typename std::vector< cv::Mat >::const_iterator constItr = vmMat_.begin();
for ( ; constItr != vmMat_.end(); ++constItr )
{
vmTmp.push_back ( cv::Mat_< T > ( *constItr ) );
}
vvvVec_ << vmTmp;
return vvvVec_;
}
template < class T >
std::vector< cv::Mat_< T > >& operator << ( std::vector< cv::Mat_< T > >& vmMat_ , const std::vector< std::vector< std::vector< T > > >& vvvVec_ )
{
vmMat_.clear();
typename std::vector< std::vector< std::vector< T > > >::const_iterator constVectorVectorItr = vvvVec_.begin();
for ( ; constVectorVectorItr != vvvVec_.end(); ++ constVectorVectorItr )
{
cv::Mat_< T > mMat;
mMat << ( *constVectorVectorItr );
vmMat_.push_back ( mMat );
}
return vmMat_;
}
template < class T >
std::vector< cv::Mat >& operator << ( std::vector< cv::Mat >& vmMat_ , const std::vector< std::vector< std::vector< T > > >& vvvVec_ )
{
std::vector< cv::Mat_< T > > vmTmp;
vmTmp << vvvVec_;
typename std::vector< cv::Mat_< T > >::const_iterator constItr = vmTmp.begin();
for ( ; constItr != vmTmp.end(); ++constItr )
{
vmMat_.push_back ( cv::Mat ( *constItr ) );
}
return vmMat_;
}
//vector< cv::Point_ > -> std::vector< < > >
template <class T>
std::vector< std::vector< T > >& operator << ( std::vector< std::vector< T > >& vvVec_, const std::vector< cv::Point_ < T > >& cvPt_ )
{
vvVec_.clear();
typename std::vector< cv::Point_< T > >::const_iterator constItr = cvPt_.begin();
for ( ; constItr != cvPt_.end(); ++constItr )
{
std::vector < T > v;
v << *constItr;
vvVec_.push_back ( v );
}
return vvVec_;
}
//vector< cv::Point3_ > -> std::vector< < > >
template <class T>
std::vector< std::vector< T > >& operator << ( std::vector< std::vector< T > >& vvVec_, const std::vector< cv::Point3_ < T > >& cvPt3_ )
{
vvVec_.clear();
typename std::vector< cv::Point3_< T > >::const_iterator constItr = cvPt3_.begin();
for ( ; constItr != cvPt3_.end(); ++constItr )
{
std::vector < T > v;
v << *constItr;
vvVec_.push_back ( v );
}
return vvVec_;
}
//vector < <> > -> std::vector< cv::Point_ >
template <class T>
std::vector< cv::Point_< T > >& operator << ( std::vector< cv::Point_< T > >& cvPt_, const std::vector< std::vector< T > >& vvVec_ )
{
cvPt_.clear();
typename std::vector< std::vector< T > >::const_iterator constItr = vvVec_.begin();
for ( ; constItr != vvVec_.end(); ++constItr )
{
cv::Point_< T > Pt;
Pt << *constItr;
cvPt_.push_back ( Pt );
}
return cvPt_;
}
// 2.3 std::vector < < < > > > -> std::vector< < cv::Point_ > >
template <class T>
std::vector< std::vector< cv::Point_< T > > >& operator << ( std::vector< std::vector< cv::Point_< T > > >& vvPt_, const std::vector< std::vector< std::vector< T > > >& vvvVec_ )
{
vvPt_.clear();
typename std::vector< std::vector< std::vector< T > > >::const_iterator constItr = vvvVec_.begin();
for ( ; constItr != vvvVec_.end(); ++constItr )
{
std::vector< cv::Point_< T > > vPt;
vPt << *constItr;
vvPt_.push_back ( vPt );
}
return vvPt_;
}
//vector < <> > -> std::vector< cv::Point3_ >
template <class T>
std::vector< cv::Point3_< T > >& operator << ( std::vector< cv::Point3_< T > >& cvPt_, const std::vector< std::vector< T > >& vvVec_ )
{
cvPt_.clear();
typename std::vector< std::vector< T > >::const_iterator constItr = vvVec_.begin();
for ( ; constItr != vvVec_.end(); ++constItr )
{
cv::Point3_< T > Pt3;
Pt3 << *constItr;
cvPt_.push_back ( Pt3 );
}
return cvPt_;
}
// 1.3 std::vector < < < > > > -> std::vector < < cv::Point3_ > >
template <class T>
std::vector< std::vector< cv::Point3_< T > > >& operator << ( std::vector< std::vector< cv::Point3_< T > > >& vvPt_, const std::vector< std::vector< std::vector< T > > >& vvvVec_ )
{
vvPt_.clear();
typename std::vector< std::vector< std::vector< T > > >::const_iterator constItr = vvvVec_.begin();
for ( ; constItr != vvvVec_.end(); ++constItr )
{
std::vector< cv::Point3_< T > > vPt3;
vPt3 << *constItr;
vvPt_.push_back ( vPt3 );
}
return vvPt_;
}
//vector< std::vector< cv::Point3_ > > -> std::vector< < < > > >
template <class T>
std::vector< std::vector< std::vector< T > > >& operator << ( std::vector< std::vector< std::vector< T > > >& vvvVec_, const std::vector< std::vector< cv::Point3_ < T > > >& vvPt3_ )
{
typename std::vector< std::vector< cv::Point3_ < T > > >::const_iterator constItr = vvPt3_.begin();
for ( ; constItr != vvPt3_.end(); ++ constItr )
{
std::vector< std::vector < T > > vv;
vv << *constItr;
vvvVec_.push_back ( vv );
}
return vvvVec_;
}
template <class T>
std::vector< std::vector< std::vector< T > > >& operator << ( std::vector< std::vector< std::vector< T > > >& vvvVec_, const std::vector< std::vector< cv::Point_< T > > >& vvPt_ )
{
typename std::vector< std::vector< cv::Point_ < T > > >::const_iterator constItr = vvPt_.begin();
for ( ; constItr != vvPt_.end(); ++ constItr )
{
std::vector< std::vector < T > > vv;
vv << *constItr;
vvvVec_.push_back ( vv );
}
return vvvVec_;
}
// 2.1 cv::Point3_ -> Vector
template < class T >
Eigen::Matrix<T, 3, 1> & operator << ( Eigen::Matrix< T, 3, 1 >& eiVec_, const cv::Point3_< T >& cvVec_ )
{
eiVec_ ( 0 ) = cvVec_.x;
eiVec_ ( 1 ) = cvVec_.y;
eiVec_ ( 2 ) = cvVec_.z;
}
// other -> other
// 1.2 Static Matrix -> cv::Mat_ < >
template < class T, int ROW, int COL >
cv::Mat_< T >& operator << ( cv::Mat_< T >& cvVec_, const Eigen::Matrix< T, ROW, COL >& eiVec_ )
{
cvVec_.create ( ROW, COL );
for ( int r = 0; r < ROW; r++ )
for ( int c = 0; c < COL; c++ )
{
cvVec_.template at<T> ( r, c ) = eiVec_ ( r, c );
}
return cvVec_;
}
// other -> other
// 1.2 Static Matrix -> cv::Mat
template < class T, int ROW, int COL >
cv::Mat& operator << ( cv::Mat& cvVec_, const Eigen::Matrix< T, ROW, COL >& eiVec_ )
{
cvVec_ = cv::Mat_< T > ( ROW, COL );
for ( int r = 0; r < ROW; r++ )
for ( int c = 0; c < COL; c++ )
{
cvVec_.template at<T> ( r, c ) = eiVec_ ( r, c );
}
return cvVec_;
}
//CvMat -> cv::Mat_
template < class T >
cv::Mat_< T >& operator << ( cv::Mat_< T >& cppM_, const CvMat& cM_ )
{
CHECK ( cppM_.type() == CV_MAT_TYPE ( cM_.type ) , "operator CvMat << cv::Mat_: the type of cv::Mat_ and CvMat is inconsistent. \n" );
CHECK ( CV_IS_MAT ( &cM_ ), "operator CvMat << cv::Mat_: the data of CvMat must be pre-allocated. \n" );
cppM_.create ( cM_.rows, cM_.cols );
for ( int r = 0; r < cM_.rows; r++ )
for ( int c = 0; c < cM_.cols; c++ )
{
cppM_.template at< T > ( r, c ) = CV_MAT_ELEM ( cM_, T, r, c );
}
return cppM_;
}
//cv::Mat_ -> CvMat
template < class T >
CvMat& operator << ( CvMat& cM_, const cv::Mat_< T >& cppM_ )
{
CHECK ( cppM_.type() == CV_MAT_TYPE ( cM_.type ) , "operator CvMat << cv::Mat_: the type of cv::Mat_ and CvMat is inconsistent. \n" );
CHECK ( CV_IS_MAT ( &cM_ ), "operator CvMat << cv::Mat_: the data of CvMat is not allocated. \n" );
CHECK ( cppM_.rows == cM_.rows , "operator CvMat << cv::Mat_: the # of rows of cv::Mat_ and CvMat is inconsistent. \n" );
CHECK ( cppM_.cols == cM_.cols, "operator CvMat << cv::Mat_: the # of cols of cv::Mat_ and CvMat is inconsistent. \n" );
for ( int r = 0; r < cppM_.rows; r++ )
for ( int c = 0; c < cppM_.cols; c++ )
{
CV_MAT_ELEM ( cM_, T, r, c ) = cppM_.template at< T > ( r, c );
}
return cM_;
}
//cv::Mat_ -> CvMat
template < class T >
void assignPtr ( cv::Mat_< T >* cppM_, CvMat* pcM_ )
{
for ( int r = 0; r < cppM_->rows; r++ )
for ( int c = 0; c < cppM_->cols; c++ )
{
CV_MAT_ELEM ( *pcM_, T, r, c ) = cppM_->template at< T > ( r, c );
}
}
//cv::CvMat -> cv::Mat_
template < class T >
void assignPtr ( CvMat* pcM_, cv::Mat_< T >* cppM_ )
{
for ( int r = 0; r < pcM_->rows; r++ )
for ( int c = 0; c < pcM_->cols; c++ )
{
cppM_->template at< T > ( r, c ) = CV_MAT_ELEM ( *pcM_, T, r, c );
}
}
// 1.1 cv::Point3_ -> std::vector
template <class T>
const cv::Point3_< T >& operator >> ( const cv::Point3_< T >& cvPt_, std::vector< T >& vVec_ )
{
vVec_ << cvPt_;
}
// 1.2 std::vector < cv::Point3_ > -> std::vector< < > >
template <class T>
const std::vector< cv::Point3_ < T > >& operator >> ( const std::vector< cv::Point3_ < T > >& vPt3_, std::vector< std::vector< T > >& vvVec_ )
{
vvVec_ << vPt3_;
}
// 1.3 std::vector < std::vector < cv::Point3_ > > -> std::vector< < < > > >
template <class T>
const std::vector< std::vector< cv::Point3_ < T > > >& operator >> ( const std::vector< std::vector< cv::Point3_ < T > > >& vvPt3_, std::vector< std::vector< std::vector< T > > >& vvvVec_ )
{
vvvVec_ << vvPt3_;
}
// 2.1 cv::Point_ -> std::vector
template <class T>
const cv::Point_< T >& operator >> ( const cv::Point_< T >& cvPt_, std::vector< T >& vVec_ )
{
vVec_ << cvPt_;
}
// 2.2 std::vector < cv::Point_ > -> std::vector< < > >
template <class T>
const std::vector< cv::Point_< T > >& operator >> ( const std::vector< cv::Point_< T > >& vPt_, std::vector< std::vector< T > >& vvVec_ )
{
vvVec_ << vPt_;
}
// 2.3 std::vector < std::vector < cv::Point_ > > -> std::vector< < < > > >
template <class T>
const std::vector< cv::Point_< T > >& operator >> ( const std::vector< std::vector< cv::Point_< T > > >& vvPt_, std::vector< std::vector< std::vector< T > > >& vvvVec_ )
{
vvvVec_ << vvPt_;
}
// 3. Static cv::Matrix -> std::vector < < > >
template < class T , int ROW, int COL >
const Eigen::Matrix< T, ROW, COL >& operator >> ( const Eigen::Matrix< T, ROW, COL >& eiMat_, std::vector< std::vector< T > >& vvVec_ )
{
vvVec_ << eiMat_;
}
// 4.1 cv::Mat_ -> std::vector
template < class T >
const cv::Mat_< T >& operator >> ( const cv::Mat_< T >& cvMat_, std::vector< std::vector< T > >& vvVec_ )
{
vvVec_ << cvMat_;
}
// 4.2 std::vector< cv::Mat_<> > -> std::vector
template < class T >
const std::vector< cv::Mat_< T > >& operator >> ( const std::vector< cv::Mat_< T > >& vmMat_, std::vector< std::vector< std::vector< T > > >& vvvVec_ )
{
vvvVec_ << vmMat_;
}
// 5.1 std::vector< cv::Mat > -> std::vector
template < class T >
const std::vector< cv::Mat >& operator >> ( const std::vector< cv::Mat >& vmMat_, std::vector< std::vector< std::vector< T > > >& vvvVec_ )
{
vvvVec_ << vmMat_;
return vmMat_;
}
// operator >>
// std::vector -> other
// 1.1 std::vector -> cv::Point3_Eigen::Matrix<short int, 2, 1,
template <class T>
const std::vector< T >& operator >> ( const std::vector< T >& vVec_, cv::Point3_< T >& cvPt_ )
{
cvPt_ << vVec_;
}
// 1.2 std::vector < < > > -> std::vector< cv::Point3_ >
template <class T>
const std::vector< std::vector< T > >& operator >> ( const std::vector< std::vector< T > >& vvVec_ , std::vector< cv::Point3_< T > >& cvPt_ )
{
cvPt_ << vvVec_;
}
// 1.3 std::vector < < < > > > -> std::vector < < cv::Point3_ > >
template <class T>
const std::vector< std::vector< std::vector< T > > >& operator >> ( const std::vector< std::vector< std::vector< T > > >& vvvVec_, std::vector< std::vector< cv::Point3_< T > > >& vvPt_ )
{
vvPt_ << vvvVec_;
return vvvVec_;
}
// 2.1 std::vector -> cv::Point_
template <class T>
const std::vector< T >& operator >> ( const std::vector< T >& vVec_, cv::Point_< T >& cvPt_ )
{
cvPt_ << vVec_;
}
// 2.2 std::vector < < > > -> std::vector< cv::Point_ >
template <class T>
const std::vector< std::vector< T > >& operator >> ( const std::vector< std::vector< T > >& vvVec_, std::vector< cv::Point_< T > >& cvPt_ )
{
cvPt_ << vvVec_;
}
// 2.3 std::vector < < < > > > -> std::vector< < cv::Point_ > >
template <class T>
const std::vector< std::vector< std::vector< T > > >& operator >> ( const std::vector< std::vector< std::vector< T > > >& vvvVec_, std::vector< std::vector< cv::Point_< T > > >& vvPt_ )
{
vvPt_ << vvvVec_;
return vvvVec_;
}
// 3.1 std::vector < < > > -> Eigen::Dynamic, Matrix
template < class T >
const std::vector< std::vector< T > >& operator >> ( const std::vector< std::vector< T > >& vvVec_, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic >& eiMat_ )
{
eiMat_ << vvVec_;
}
// 3.2 std::vector < < > > -> Static, Matrix
template < class T , int ROW, int COL>
const std::vector< std::vector< T > >& operator >> ( const std::vector< std::vector< T > >& vvVec_, Eigen::Matrix< T, ROW, COL >& eiMat_ )
{
eiMat_ << vvVec_;
return vvVec_;
}
// 4.1 std::vector -> cv::Mat_
template < class T >
const std::vector< std::vector< T > >& operator >> ( const std::vector< std::vector< T > >& vvVec_, cv::Mat_< T >& cvMat_ )
{
cvMat_ << vvVec_;
return vvVec_;
}
// 4.2 std::vector< < < > > > -> std::vector< cv::Mat_<> >
template < class T >
const std::vector< std::vector< std::vector< T > > >& operator >> ( const std::vector< std::vector< std::vector< T > > >& vvvVec_, std::vector< cv::Mat_< T > >& vmMat_ )
{
vmMat_ << vvvVec_;
}
// 5.1 std::vector< < < > > > -> std::vector< cv::Mat >
template < class T >
const std::vector< std::vector< std::vector< T > > >& operator >> ( const std::vector< std::vector< std::vector< T > > >& vvvVec_, std::vector< cv::Mat >& vmMat_ )
{
vmMat_ << vvvVec_;
return vvvVec_;
}
//template< class T >
//Matrix< T, 3, 3 > skewSymmetric( const Matrix< T, 3, 1>& eivVec_ )
//{
// Matrix< T, 3, 3 > eimMat;
// /*0*/ eimMat(0,1) = -eivVec_(2); eimMat(0,2) = eivVec_(1);
// eimMat(1,0) = eivVec_(2); /*0*/ eimMat(1,2) = -eivVec_(0);
// eimMat(2,0) = -eivVec_(1); eimMat(2,1) = eivVec_(0); /*0*/
// return eimMat;
//}
/*
template< class T >
Matrix< T, 3,3> fundamental(const Matrix< T, 3, 3 >& eimK1_, const Matrix< T, 3, 3 >& eimK2_, const Matrix< T, 3,3>& eimR_, const Matrix< T, 3,1 >& eivT_, cv::Mat_< T >* pcvmDepthNew_ )
{
// compute fundamental matrix that the first camera is on classic pose and the second is on R and T pose, the internal
// parameters of first camera is K1, and the second is K2
// reference Multiple view geometry on computer vision page 244.
// F = K2^{-T}RK^{T} * skew( K R^{T} t );
Matrix< T, 3, 3> eimF = eimK2_.inverse().eval().transpose() * eimR_ * eimK1_.transpose() * skewSymmetric( eimK1_ * eimR_.transpose() * eivT_ );
return eimF;
}
*/
}//utility
}//btl
#endif
|
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2013-2019 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
* ndn-cxx library is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received copies of the GNU General Public License and GNU Lesser
* General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
* <http://www.gnu.org/licenses/>.
*
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
#include "ndn-cxx/mgmt/nfd/fib-entry.hpp"
#include "tests/boost-test.hpp"
#include <boost/lexical_cast.hpp>
namespace ndn {
namespace nfd {
namespace tests {
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
BOOST_AUTO_TEST_SUITE(TestFibEntry)
static FibEntry
makeFibEntry()
{
std::vector<NextHopRecord> nexthops;
for (size_t i = 1; i < 4; i++) {
nexthops.push_back(NextHopRecord()
.setFaceId(i * 10)
.setCost(i * 100 + 100));
}
return FibEntry()
.setPrefix("/this/is/a/test")
.setNextHopRecords(nexthops.begin(), nexthops.end());
}
BOOST_AUTO_TEST_CASE(NextHopRecordEncode)
{
NextHopRecord record1;
record1.setFaceId(10)
.setCost(200);
const Block& wire = record1.wireEncode();
static const uint8_t expected[] = {
0x81, 0x06, // NextHopRecord
0x69, 0x01, 0x0a, // FaceId
0x6a, 0x01, 0xc8, // Cost
};
BOOST_CHECK_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
wire.begin(), wire.end());
NextHopRecord record2(wire);
BOOST_CHECK_EQUAL(record1, record2);
}
BOOST_AUTO_TEST_CASE(NextHopRecordEquality)
{
NextHopRecord record1, record2;
record1.setFaceId(10)
.setCost(200);
record2 = record1;
BOOST_CHECK_EQUAL(record1, record2);
record2.setFaceId(42);
BOOST_CHECK_NE(record1, record2);
record2 = record1;
record2.setCost(42);
BOOST_CHECK_NE(record1, record2);
}
BOOST_AUTO_TEST_CASE(FibEntryNoNextHopsEncode)
{
FibEntry entry1;
entry1.setPrefix("/this/is/a/test");
BOOST_REQUIRE(entry1.getNextHopRecords().empty());
const Block& wire = entry1.wireEncode();
static const uint8_t expected[] = {
0x80, 0x15, 0x07, 0x13, 0x08, 0x04, 0x74, 0x68, 0x69, 0x73,
0x08, 0x02, 0x69, 0x73, 0x08, 0x01, 0x61, 0x08, 0x04, 0x74,
0x65, 0x73, 0x74
};
BOOST_CHECK_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
wire.begin(), wire.end());
FibEntry entry2(wire);
BOOST_CHECK_EQUAL(entry1, entry2);
}
BOOST_AUTO_TEST_CASE(FibEntryEncode)
{
FibEntry entry1 = makeFibEntry();
NextHopRecord oneMore;
oneMore.setFaceId(40);
oneMore.setCost(500);
entry1.addNextHopRecord(oneMore);
const Block& wire = entry1.wireEncode();
static const uint8_t expected[] = {
0x80, 0x38, // FibEntry
0x07, 0x13, // Name
0x08, 0x04, 0x74, 0x68, 0x69, 0x73, // GenericNameComponent
0x08, 0x02, 0x69, 0x73, // GenericNameComponent
0x08, 0x01, 0x61, // GenericNameComponent
0x08, 0x04, 0x74, 0x65, 0x73, 0x74, // GenericNameComponent
0x81, 0x06, // NextHopRecord
0x69, 0x01, 0x0a, // FaceId
0x6a, 0x01, 0xc8, // Cost
0x81, 0x07, // NextHopRecord
0x69, 0x01, 0x14, // FaceId
0x6a, 0x02, 0x01, 0x2c, // Cost
0x81, 0x07, // NextHopRecord
0x69, 0x01, 0x1e, // FaceId
0x6a, 0x02, 0x01, 0x90, // Cost
0x81, 0x07, // NextHopRecord
0x69, 0x01, 0x28, // FaceId
0x6a, 0x02, 0x01, 0xf4, // Cost
};
BOOST_CHECK_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
wire.begin(), wire.end());
FibEntry entry2(wire);
BOOST_CHECK_EQUAL(entry1, entry2);
}
BOOST_AUTO_TEST_CASE(FibEntryEquality)
{
FibEntry entry1, entry2;
BOOST_CHECK_EQUAL(entry1, entry2);
entry1 = entry2 = makeFibEntry();
BOOST_CHECK_EQUAL(entry1, entry2);
BOOST_CHECK_EQUAL(entry2, entry1);
entry2.setPrefix("/another/prefix");
BOOST_CHECK_NE(entry1, entry2);
entry2 = entry1;
std::vector<NextHopRecord> empty;
entry2.setNextHopRecords(empty.begin(), empty.end());
BOOST_CHECK_NE(entry1, entry2);
BOOST_CHECK_NE(entry2, entry1);
entry2 = entry1;
auto nh1 = NextHopRecord()
.setFaceId(1)
.setCost(1000);
entry1.addNextHopRecord(nh1);
BOOST_CHECK_NE(entry1, entry2);
BOOST_CHECK_NE(entry2, entry1);
auto nh42 = NextHopRecord()
.setFaceId(42)
.setCost(42);
entry1.addNextHopRecord(nh42);
entry2.addNextHopRecord(nh42)
.addNextHopRecord(nh1);
BOOST_CHECK_EQUAL(entry1, entry2); // order of NextHopRecords is irrelevant
BOOST_CHECK_EQUAL(entry2, entry1);
entry1 = entry2 = makeFibEntry();
entry1.addNextHopRecord(nh1)
.addNextHopRecord(nh42);
entry2.addNextHopRecord(nh42)
.addNextHopRecord(nh42);
BOOST_CHECK_NE(entry1, entry2); // match each NextHopRecord at most once
BOOST_CHECK_NE(entry2, entry1);
}
BOOST_AUTO_TEST_CASE(Print)
{
NextHopRecord record;
BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(record),
"NextHopRecord(FaceId: 0, Cost: 0)");
FibEntry entry;
BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(entry),
"FibEntry(Prefix: /,\n"
" NextHops: []\n"
" )");
entry = makeFibEntry();
BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(entry),
"FibEntry(Prefix: /this/is/a/test,\n"
" NextHops: [NextHopRecord(FaceId: 10, Cost: 200),\n"
" NextHopRecord(FaceId: 20, Cost: 300),\n"
" NextHopRecord(FaceId: 30, Cost: 400)]\n"
" )");
}
BOOST_AUTO_TEST_SUITE_END() // TestFibEntry
BOOST_AUTO_TEST_SUITE_END() // Nfd
BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
} // namespace ndn
|
/*
Copyright (c) 2016-2019 Xavier Leclercq
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
#include "wx/charts/wxstackedcolumnchartoptions.h"
wxStackedColumnChartOptions::wxStackedColumnChartOptions()
: m_gridOptions(
wxChartsAxisOptions(wxCHARTSAXISPOSITION_BOTTOM, wxCHARTSAXISLABELTYPE_RANGE),
wxChartsAxisOptions(wxCHARTSAXISPOSITION_LEFT)
),
m_columnSpacing(15)
{
m_gridOptions.GetYAxisOptions().SetExplicitStartValue(0);
}
const wxChartsGridOptions& wxStackedColumnChartOptions::GetGridOptions() const
{
return m_gridOptions;
}
wxDouble wxStackedColumnChartOptions::GetColumnSpacing() const
{
return m_columnSpacing;
}
|
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ability_scheduler_stub.h"
#include "hilog_wrapper.h"
#include "ipc_types.h"
#include "pac_map.h"
#include "want.h"
namespace OHOS {
namespace AAFwk {
AbilitySchedulerStub::AbilitySchedulerStub()
{
requestFuncMap_[SCHEDULE_ABILITY_TRANSACTION] = &AbilitySchedulerStub::AbilityTransactionInner;
requestFuncMap_[SEND_RESULT] = &AbilitySchedulerStub::SendResultInner;
requestFuncMap_[SCHEDULE_ABILITY_CONNECT] = &AbilitySchedulerStub::ConnectAbilityInner;
requestFuncMap_[SCHEDULE_ABILITY_DISCONNECT] = &AbilitySchedulerStub::DisconnectAbilityInner;
requestFuncMap_[SCHEDULE_ABILITY_COMMAND] = &AbilitySchedulerStub::CommandAbilityInner;
requestFuncMap_[SCHEDULE_SAVE_ABILITY_STATE] = &AbilitySchedulerStub::SaveAbilityStateInner;
requestFuncMap_[SCHEDULE_RESTORE_ABILITY_STATE] = &AbilitySchedulerStub::RestoreAbilityStateInner;
requestFuncMap_[SCHEDULE_GETFILETYPES] = &AbilitySchedulerStub::GetFileTypesInner;
requestFuncMap_[SCHEDULE_OPENFILE] = &AbilitySchedulerStub::OpenFileInner;
requestFuncMap_[SCHEDULE_OPENRAWFILE] = &AbilitySchedulerStub::OpenRawFileInner;
requestFuncMap_[SCHEDULE_INSERT] = &AbilitySchedulerStub::InsertInner;
requestFuncMap_[SCHEDULE_UPDATE] = &AbilitySchedulerStub::UpdatetInner;
requestFuncMap_[SCHEDULE_DELETE] = &AbilitySchedulerStub::DeleteInner;
requestFuncMap_[SCHEDULE_QUERY] = &AbilitySchedulerStub::QueryInner;
requestFuncMap_[SCHEDULE_GETTYPE] = &AbilitySchedulerStub::GetTypeInner;
requestFuncMap_[SCHEDULE_RELOAD] = &AbilitySchedulerStub::ReloadInner;
requestFuncMap_[SCHEDULE_BATCHINSERT] = &AbilitySchedulerStub::BatchInsertInner;
}
AbilitySchedulerStub::~AbilitySchedulerStub()
{
requestFuncMap_.clear();
}
int AbilitySchedulerStub::OnRemoteRequest(
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
{
HILOG_DEBUG("AbilitySchedulerStub::OnRemoteRequest, cmd = %d, flags= %d", code, option.GetFlags());
std::u16string descriptor = AbilitySchedulerStub::GetDescriptor();
std::u16string remoteDescriptor = data.ReadInterfaceToken();
if (descriptor != remoteDescriptor) {
HILOG_INFO("local descriptor is not equal to remote");
return ERR_INVALID_STATE;
}
auto itFunc = requestFuncMap_.find(code);
if (itFunc != requestFuncMap_.end()) {
auto requestFunc = itFunc->second;
if (requestFunc != nullptr) {
return (this->*requestFunc)(data, reply);
}
}
HILOG_WARN("AbilitySchedulerStub::OnRemoteRequest, default case, need check.");
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
}
int AbilitySchedulerStub::AbilityTransactionInner(MessageParcel &data, MessageParcel &reply)
{
Want *want = data.ReadParcelable<Want>();
if (want == nullptr) {
HILOG_ERROR("AbilitySchedulerStub want is nullptr");
return ERR_INVALID_VALUE;
}
std::unique_ptr<LifeCycleStateInfo> stateInfo(data.ReadParcelable<LifeCycleStateInfo>());
if (!stateInfo) {
HILOG_ERROR("ReadParcelable<LifeCycleStateInfo> failed");
return ERR_INVALID_VALUE;
}
ScheduleAbilityTransaction(*want, *stateInfo);
delete want;
return NO_ERROR;
}
int AbilitySchedulerStub::SendResultInner(MessageParcel &data, MessageParcel &reply)
{
int requestCode = data.ReadInt32();
int resultCode = data.ReadInt32();
Want *want = data.ReadParcelable<Want>();
if (want == nullptr) {
HILOG_ERROR("AbilitySchedulerStub want is nullptr");
return ERR_INVALID_VALUE;
}
SendResult(requestCode, resultCode, *want);
delete want;
return NO_ERROR;
}
int AbilitySchedulerStub::ConnectAbilityInner(MessageParcel &data, MessageParcel &reply)
{
Want *want = data.ReadParcelable<Want>();
if (want == nullptr) {
HILOG_ERROR("AbilitySchedulerStub want is nullptr");
return ERR_INVALID_VALUE;
}
ScheduleConnectAbility(*want);
delete want;
return NO_ERROR;
}
int AbilitySchedulerStub::DisconnectAbilityInner(MessageParcel &data, MessageParcel &reply)
{
Want *want = data.ReadParcelable<Want>();
if (want == nullptr) {
HILOG_ERROR("AbilitySchedulerStub want is nullptr");
return ERR_INVALID_VALUE;
}
ScheduleDisconnectAbility(*want);
delete want;
return NO_ERROR;
}
int AbilitySchedulerStub::CommandAbilityInner(MessageParcel &data, MessageParcel &reply)
{
Want *want = data.ReadParcelable<Want>();
if (want == nullptr) {
HILOG_ERROR("AbilitySchedulerStub want is nullptr");
return ERR_INVALID_VALUE;
}
bool reStart = data.ReadBool();
int startId = data.ReadInt32();
ScheduleCommandAbility(*want, reStart, startId);
delete want;
return NO_ERROR;
}
int AbilitySchedulerStub::SaveAbilityStateInner(MessageParcel &data, MessageParcel &reply)
{
return NO_ERROR;
}
int AbilitySchedulerStub::RestoreAbilityStateInner(MessageParcel &data, MessageParcel &reply)
{
HILOG_INFO("RestoreAbilityStateInner");
return NO_ERROR;
}
int AbilitySchedulerStub::GetFileTypesInner(MessageParcel &data, MessageParcel &reply)
{
Uri *uri = data.ReadParcelable<Uri>();
if (uri == nullptr) {
HILOG_ERROR("AbilitySchedulerStub uri is nullptr");
return ERR_INVALID_VALUE;
}
std::string mimeTypeFilter = data.ReadString();
if (mimeTypeFilter.empty()) {
HILOG_ERROR("AbilitySchedulerStub mimeTypeFilter is nullptr");
return ERR_INVALID_VALUE;
}
std::vector<std::string> types = GetFileTypes(*uri, mimeTypeFilter);
if (!reply.WriteStringVector(types)) {
HILOG_ERROR("fail to WriteStringVector types");
return ERR_INVALID_VALUE;
}
delete uri;
return NO_ERROR;
}
int AbilitySchedulerStub::OpenFileInner(MessageParcel &data, MessageParcel &reply)
{
Uri *uri = data.ReadParcelable<Uri>();
if (uri == nullptr) {
HILOG_ERROR("AbilitySchedulerStub uri is nullptr");
return ERR_INVALID_VALUE;
}
std::string mode = data.ReadString();
if (mode.empty()) {
HILOG_ERROR("AbilitySchedulerStub mode is nullptr");
return ERR_INVALID_VALUE;
}
int fd = OpenFile(*uri, mode);
if (!reply.WriteFileDescriptor(fd)) {
HILOG_ERROR("fail to WriteFileDescriptor fd");
return ERR_INVALID_VALUE;
}
delete uri;
return NO_ERROR;
}
int AbilitySchedulerStub::OpenRawFileInner(MessageParcel &data, MessageParcel &reply)
{
Uri *uri = data.ReadParcelable<Uri>();
if (uri == nullptr) {
HILOG_ERROR("AbilitySchedulerStub uri is nullptr");
return ERR_INVALID_VALUE;
}
std::string mode = data.ReadString();
if (mode.empty()) {
HILOG_ERROR("AbilitySchedulerStub mode is nullptr");
return ERR_INVALID_VALUE;
}
int fd = OpenRawFile(*uri, mode);
if (!reply.WriteInt32(fd)) {
HILOG_ERROR("fail to WriteInt32 fd");
return ERR_INVALID_VALUE;
}
delete uri;
return NO_ERROR;
}
int AbilitySchedulerStub::InsertInner(MessageParcel &data, MessageParcel &reply)
{
Uri *uri = data.ReadParcelable<Uri>();
if (uri == nullptr) {
HILOG_ERROR("AbilitySchedulerStub uri is nullptr");
return ERR_INVALID_VALUE;
}
ValuesBucket *value = data.ReadParcelable<ValuesBucket>();
if (value == nullptr) {
HILOG_ERROR("ReadParcelable value is nullptr");
return ERR_INVALID_VALUE;
}
int index = Insert(*uri, *value);
if (!reply.WriteInt32(index)) {
HILOG_ERROR("fail to WriteInt32 index");
return ERR_INVALID_VALUE;
}
delete uri;
delete value;
return NO_ERROR;
}
int AbilitySchedulerStub::UpdatetInner(MessageParcel &data, MessageParcel &reply)
{
Uri *uri = data.ReadParcelable<Uri>();
if (uri == nullptr) {
HILOG_ERROR("AbilitySchedulerStub uri is nullptr");
return ERR_INVALID_VALUE;
}
ValuesBucket *value = data.ReadParcelable<ValuesBucket>();
if (value == nullptr) {
HILOG_ERROR("ReadParcelable value is nullptr");
return ERR_INVALID_VALUE;
}
DataAbilityPredicates *predicates = data.ReadParcelable<DataAbilityPredicates>();
if (predicates == nullptr) {
HILOG_ERROR("ReadParcelable predicates is nullptr");
return ERR_INVALID_VALUE;
}
int index = Update(*uri, *value, *predicates);
if (!reply.WriteInt32(index)) {
HILOG_ERROR("fail to WriteInt32 index");
return ERR_INVALID_VALUE;
}
delete uri;
delete value;
delete predicates;
return NO_ERROR;
}
int AbilitySchedulerStub::DeleteInner(MessageParcel &data, MessageParcel &reply)
{
Uri *uri = data.ReadParcelable<Uri>();
if (uri == nullptr) {
HILOG_ERROR("AbilitySchedulerStub uri is nullptr");
return ERR_INVALID_VALUE;
}
DataAbilityPredicates *predicates = data.ReadParcelable<DataAbilityPredicates>();
if (predicates == nullptr) {
HILOG_ERROR("ReadParcelable predicates is nullptr");
return ERR_INVALID_VALUE;
}
int index = Delete(*uri, *predicates);
if (!reply.WriteInt32(index)) {
HILOG_ERROR("fail to WriteInt32 index");
return ERR_INVALID_VALUE;
}
delete uri;
delete predicates;
return NO_ERROR;
}
int AbilitySchedulerStub::QueryInner(MessageParcel &data, MessageParcel &reply)
{
Uri *uri = data.ReadParcelable<Uri>();
if (uri == nullptr) {
HILOG_ERROR("AbilitySchedulerStub uri is nullptr");
return ERR_INVALID_VALUE;
}
std::vector<std::string> columns;
if (!data.ReadStringVector(&columns)) {
HILOG_ERROR("fail to ReadStringVector columns");
return ERR_INVALID_VALUE;
}
DataAbilityPredicates *predicates = data.ReadParcelable<DataAbilityPredicates>();
if (predicates == nullptr) {
HILOG_ERROR("ReadParcelable predicates is nullptr");
return ERR_INVALID_VALUE;
}
std::shared_ptr<ResultSet> resultSet = Query(*uri, columns, *predicates);
ResultSet *resultSetPtr = resultSet.get();
if (resultSetPtr == nullptr || !reply.WriteParcelable(resultSetPtr)) {
HILOG_ERROR("fail to WriteParcelable resultSet");
return ERR_INVALID_VALUE;
}
delete uri;
delete predicates;
return NO_ERROR;
}
int AbilitySchedulerStub::GetTypeInner(MessageParcel &data, MessageParcel &reply)
{
Uri *uri = data.ReadParcelable<Uri>();
if (uri == nullptr) {
HILOG_ERROR("AbilitySchedulerStub uri is nullptr");
return ERR_INVALID_VALUE;
}
std::string type = GetType(*uri);
if (!reply.WriteString(type)) {
HILOG_ERROR("fail to WriteString type");
return ERR_INVALID_VALUE;
}
delete uri;
return NO_ERROR;
}
int AbilitySchedulerStub::ReloadInner(MessageParcel &data, MessageParcel &reply)
{
Uri *uri = data.ReadParcelable<Uri>();
if (uri == nullptr) {
HILOG_ERROR("AbilitySchedulerStub uri is nullptr");
return ERR_INVALID_VALUE;
}
PacMap *extras = data.ReadParcelable<PacMap>();
if (extras == nullptr) {
HILOG_ERROR("AbilitySchedulerStub extras is nullptr");
return ERR_INVALID_VALUE;
}
bool ret = Reload(*uri, *extras);
if (!reply.WriteBool(ret)) {
HILOG_ERROR("fail to writeBool ret");
return ERR_INVALID_VALUE;
}
delete uri;
delete extras;
return NO_ERROR;
}
int AbilitySchedulerStub::BatchInsertInner(MessageParcel &data, MessageParcel &reply)
{
Uri *uri = data.ReadParcelable<Uri>();
if (uri == nullptr) {
HILOG_ERROR("AbilitySchedulerStub uri is nullptr");
return ERR_INVALID_VALUE;
}
int count = 0;
if (!data.ReadInt32(count)) {
HILOG_ERROR("fail to ReadInt32 index");
return ERR_INVALID_VALUE;
}
std::vector<ValuesBucket> values;
for (int i = 0; i < count; i++) {
ValuesBucket *value = data.ReadParcelable<ValuesBucket>();
if (value == nullptr) {
HILOG_ERROR("AbilitySchedulerStub value is nullptr, index = %{public}d", i);
return ERR_INVALID_VALUE;
}
values.emplace_back(*value);
}
int ret = BatchInsert(*uri, values);
if (!reply.WriteInt32(ret)) {
HILOG_ERROR("fail to WriteInt32 ret");
return ERR_INVALID_VALUE;
}
delete uri;
return NO_ERROR;
}
void AbilitySchedulerRecipient::OnRemoteDied(const wptr<IRemoteObject> &remote)
{
HILOG_ERROR("recv AbilitySchedulerRecipient death notice");
if (handler_) {
handler_(remote);
}
}
AbilitySchedulerRecipient::AbilitySchedulerRecipient(RemoteDiedHandler handler) : handler_(handler)
{}
AbilitySchedulerRecipient::~AbilitySchedulerRecipient()
{}
} // namespace AAFwk
} // namespace OHOS
|
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <AzTest/AzTest.h>
#include <Common/RPITestFixture.h>
#include <Common/JsonTestUtils.h>
#include <Common/ErrorMessageFinder.h>
#include <Common/ShaderAssetTestUtils.h>
#include <Atom/RPI.Reflect/Material/MaterialFunctor.h>
#include <Atom/RPI.Reflect/Material/MaterialTypeAsset.h>
#include <Atom/RPI.Reflect/Material/MaterialTypeAssetCreator.h>
#include <Atom/RPI.Reflect/Material/MaterialAssetCreator.h>
#include <Atom/RPI.Edit/Material/MaterialFunctorSourceData.h>
#include <Atom/RPI.Public/Material/Material.h>
#include <Material/MaterialAssetTestUtils.h>
namespace UnitTest
{
using namespace AZ;
using namespace RPI;
class MaterialFunctorTests
: public RPITestFixture
{
public:
class SetShaderOptionFunctor final
: public MaterialFunctor
{
public:
AZ_RTTI(SetShaderOptionFunctor, "{6316D98D-D2DD-4E9C-808C-58118DC9FF73}", MaterialFunctor);
SetShaderOptionFunctor(size_t shaderIndex, ShaderOptionIndex shaderOptionIndex, ShaderOptionValue shaderOptionValue)
: m_shaderIndex(shaderIndex)
, m_shaderOptionIndex(shaderOptionIndex)
, m_shaderOptionValue(shaderOptionValue)
{
}
using MaterialFunctor::Process;
void Process(MaterialFunctor::RuntimeContext& context) override
{
m_processResult = context.SetShaderOptionValue(0, m_shaderOptionIndex, m_shaderOptionValue);
}
// Note a real functor wouldn't do this, it's just for testing
bool GetProcessResult()
{
return m_processResult;
}
private:
size_t m_shaderIndex;
ShaderOptionIndex m_shaderOptionIndex;
ShaderOptionValue m_shaderOptionValue;
bool m_processResult = false;
};
class PropertyDependencyTestFunctor final
: public MaterialFunctor
{
public:
MOCK_METHOD0(ProcessCalled, void());
using MaterialFunctor::Process;
void Process(RuntimeContext& context) override
{
ProcessCalled();
context.GetMaterialPropertyValue<int32_t>(m_registedPropertyIndex);
context.GetMaterialPropertyValue<int32_t>(m_registedPropertyName);
// Should report error in the call.
context.GetMaterialPropertyValue<int32_t>(m_unregistedPropertyIndex);
context.GetMaterialPropertyValue<int32_t>(m_unregistedPropertyName);
}
MaterialPropertyIndex m_registedPropertyIndex;
MaterialPropertyIndex m_unregistedPropertyIndex;
AZ::Name m_registedPropertyName;
AZ::Name m_unregistedPropertyName;
};
class PropertyDependencyTestFunctorSourceData final
: public MaterialFunctorSourceData
{
public:
using MaterialFunctorSourceData::CreateFunctor;
FunctorResult CreateFunctor(const RuntimeContext& context) const override
{
Ptr<PropertyDependencyTestFunctor> functor = aznew PropertyDependencyTestFunctor;
functor->m_registedPropertyIndex = context.FindMaterialPropertyIndex(Name{ m_registedPropertyName });
EXPECT_TRUE(!functor->m_registedPropertyIndex.IsNull());
AddMaterialPropertyDependency(functor, functor->m_registedPropertyIndex);
functor->m_unregistedPropertyIndex = context.FindMaterialPropertyIndex(Name{ m_unregistedPropertyName });
EXPECT_TRUE(!functor->m_unregistedPropertyIndex.IsNull());
// Intended missing registration to m_materialPropertyDependencies
functor->m_registedPropertyName = m_registedPropertyName;
functor->m_unregistedPropertyName = m_unregistedPropertyName;
return Success(Ptr<MaterialFunctor>(functor));
}
AZStd::string m_registedPropertyName;
AZStd::string m_unregistedPropertyName;
};
protected:
void SetUp() override
{
RPITestFixture::SetUp();
}
void TearDown() override
{
RPITestFixture::TearDown();
}
};
TEST_F(MaterialFunctorTests, MaterialFunctor_RuntimeContext_ShaderOptionNotOwned)
{
using namespace AZ::RPI;
AZStd::vector<RPI::ShaderOptionValuePair> boolOptionValues;
boolOptionValues.push_back({Name("False"), RPI::ShaderOptionValue(0)});
boolOptionValues.push_back({Name("True"), RPI::ShaderOptionValue(1)});
AZ::RPI::Ptr<AZ::RPI::ShaderOptionGroupLayout> shaderOptions = RPI::ShaderOptionGroupLayout::Create();
shaderOptions->AddShaderOption(ShaderOptionDescriptor{Name{"o_optionA"}, ShaderOptionType::Boolean, 0, 0, boolOptionValues, Name{"False"}});
shaderOptions->AddShaderOption(ShaderOptionDescriptor{Name{"o_optionB"}, ShaderOptionType::Boolean, 1, 1, boolOptionValues, Name{"False"}});
shaderOptions->AddShaderOption(ShaderOptionDescriptor{Name{"o_optionC"}, ShaderOptionType::Boolean, 2, 2, boolOptionValues, Name{"False"}});
shaderOptions->Finalize();
Data::Asset<MaterialTypeAsset> materialTypeAsset;
//Data::Asset<MaterialAsset> materialAsset;
// Note we don't actually need any properties or functors in the material type. We just need to set up some sample data
// structures that we can pass to the functors below, especially the shader with shader options.
MaterialTypeAssetCreator materialTypeCreator;
materialTypeCreator.Begin(Uuid::CreateRandom());
materialTypeCreator.AddShader(CreateTestShaderAsset(Uuid::CreateRandom(), CreateCommonTestMaterialSrgLayout(), shaderOptions));
// We claim ownership of options A and B, but not C. So C is a globally accessible option, not owned by the material.
materialTypeCreator.ClaimShaderOptionOwnership(Name{"o_optionA"});
materialTypeCreator.ClaimShaderOptionOwnership(Name{"o_optionB"});
EXPECT_TRUE(materialTypeCreator.End(materialTypeAsset));
SetShaderOptionFunctor testFunctorSetOptionA{0, ShaderOptionIndex{0}, ShaderOptionValue{1}};
SetShaderOptionFunctor testFunctorSetOptionB{0, ShaderOptionIndex{1}, ShaderOptionValue{1}};
SetShaderOptionFunctor testFunctorSetOptionC{0, ShaderOptionIndex{2}, ShaderOptionValue{1}};
SetShaderOptionFunctor testFunctorSetOptionInvalid{0, ShaderOptionIndex{3}, ShaderOptionValue{1}};
// Most of this data can be empty since this particular functor doesn't access it.
AZStd::vector<MaterialPropertyValue> unusedPropertyValues;
ShaderResourceGroup* unusedSrg = nullptr;
ShaderCollection shaderCollectionCopy = materialTypeAsset->GetShaderCollection();
{
// Successfully set o_optionA
MaterialFunctor::RuntimeContext runtimeContext = MaterialFunctor::RuntimeContext{
unusedPropertyValues,
materialTypeAsset->GetMaterialPropertiesLayout(),
&shaderCollectionCopy,
unusedSrg,
&testFunctorSetOptionA.GetMaterialPropertyDependencies(),
AZ::RPI::MaterialPropertyPsoHandling::Allowed
};
testFunctorSetOptionA.Process(runtimeContext);
EXPECT_TRUE(testFunctorSetOptionA.GetProcessResult());
EXPECT_EQ(1, shaderCollectionCopy[0].GetShaderOptions()->GetValue(ShaderOptionIndex{ 0 }).GetIndex());
EXPECT_NE(1, shaderCollectionCopy[0].GetShaderOptions()->GetValue(ShaderOptionIndex{ 1 }).GetIndex());
EXPECT_NE(1, shaderCollectionCopy[0].GetShaderOptions()->GetValue(ShaderOptionIndex{ 2 }).GetIndex());
}
{
// Successfully set o_optionB
MaterialFunctor::RuntimeContext runtimeContext = MaterialFunctor::RuntimeContext{
unusedPropertyValues,
materialTypeAsset->GetMaterialPropertiesLayout(),
&shaderCollectionCopy,
unusedSrg,
&testFunctorSetOptionB.GetMaterialPropertyDependencies(),
AZ::RPI::MaterialPropertyPsoHandling::Allowed
};
testFunctorSetOptionB.Process(runtimeContext);
EXPECT_TRUE(testFunctorSetOptionB.GetProcessResult());
EXPECT_EQ(1, shaderCollectionCopy[0].GetShaderOptions()->GetValue(ShaderOptionIndex{ 0 }).GetIndex());
EXPECT_EQ(1, shaderCollectionCopy[0].GetShaderOptions()->GetValue(ShaderOptionIndex{ 1 }).GetIndex());
EXPECT_NE(1, shaderCollectionCopy[0].GetShaderOptions()->GetValue(ShaderOptionIndex{ 2 }).GetIndex());
}
{
// Fail to set o_optionC because it is not owned by the material type
AZ_TEST_START_TRACE_SUPPRESSION;
MaterialFunctor::RuntimeContext runtimeContext = MaterialFunctor::RuntimeContext{
unusedPropertyValues,
materialTypeAsset->GetMaterialPropertiesLayout(),
&shaderCollectionCopy,
unusedSrg,
&testFunctorSetOptionC.GetMaterialPropertyDependencies(),
AZ::RPI::MaterialPropertyPsoHandling::Allowed
};
testFunctorSetOptionC.Process(runtimeContext);
EXPECT_FALSE(testFunctorSetOptionC.GetProcessResult());
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
}
{
// Fail to set option index that is out of range
AZ_TEST_START_TRACE_SUPPRESSION;
MaterialFunctor::RuntimeContext runtimeContext = MaterialFunctor::RuntimeContext{
unusedPropertyValues,
materialTypeAsset->GetMaterialPropertiesLayout(),
&shaderCollectionCopy,
unusedSrg,
&testFunctorSetOptionInvalid.GetMaterialPropertyDependencies(),
AZ::RPI::MaterialPropertyPsoHandling::Allowed
};
testFunctorSetOptionInvalid.Process(runtimeContext);
EXPECT_FALSE(testFunctorSetOptionInvalid.GetProcessResult());
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
}
EXPECT_EQ(1, shaderCollectionCopy[0].GetShaderOptions()->GetValue(ShaderOptionIndex{0}).GetIndex());
EXPECT_EQ(1, shaderCollectionCopy[0].GetShaderOptions()->GetValue(ShaderOptionIndex{1}).GetIndex());
EXPECT_NE(1, shaderCollectionCopy[0].GetShaderOptions()->GetValue(ShaderOptionIndex{2}).GetIndex());
}
TEST_F(MaterialFunctorTests, ReprocessTest)
{
Data::Asset<MaterialTypeAsset> m_testMaterialTypeAsset;
Data::Asset<MaterialAsset> m_testMaterialAsset;
AZ::Name registedPropertyName("PropA");
AZ::Name unregistedPropertyName("PropB");
AZ::Name unrelatedPropertyName("PropC");
MaterialTypeAssetCreator materialTypeCreator;
materialTypeCreator.Begin(Uuid::CreateRandom());
materialTypeCreator.BeginMaterialProperty(registedPropertyName, AZ::RPI::MaterialPropertyDataType::Int);
materialTypeCreator.EndMaterialProperty();
materialTypeCreator.BeginMaterialProperty(unregistedPropertyName, AZ::RPI::MaterialPropertyDataType::Int);
materialTypeCreator.EndMaterialProperty();
materialTypeCreator.BeginMaterialProperty(unrelatedPropertyName, AZ::RPI::MaterialPropertyDataType::Int);
materialTypeCreator.EndMaterialProperty();
materialTypeCreator.SetPropertyValue(registedPropertyName, 42);
materialTypeCreator.SetPropertyValue(unregistedPropertyName, 42);
materialTypeCreator.SetPropertyValue(unrelatedPropertyName, 42);
PropertyDependencyTestFunctorSourceData functorSourceData;
functorSourceData.m_registedPropertyName = registedPropertyName.GetStringView();
functorSourceData.m_unregistedPropertyName = unregistedPropertyName.GetStringView();
MaterialFunctorSourceData::FunctorResult result = functorSourceData.CreateFunctor(
MaterialFunctorSourceData::RuntimeContext(
"Dummy.materialtype",
materialTypeCreator.GetMaterialPropertiesLayout(),
materialTypeCreator.GetMaterialShaderResourceGroupLayout(),
materialTypeCreator.GetShaderCollection()
)
);
EXPECT_TRUE(result.IsSuccess());
Ptr<MaterialFunctor>& functor = result.GetValue();
EXPECT_TRUE(functor != nullptr);
materialTypeCreator.AddMaterialFunctor(functor);
materialTypeCreator.End(m_testMaterialTypeAsset);
MaterialAssetCreator materialCreator;
materialCreator.Begin(Uuid::CreateRandom(), *m_testMaterialTypeAsset);
materialCreator.SetPropertyValue(registedPropertyName, 42);
materialCreator.SetPropertyValue(unregistedPropertyName, 42);
materialCreator.SetPropertyValue(unrelatedPropertyName, 42);
materialCreator.End(m_testMaterialAsset);
EXPECT_TRUE(m_testMaterialAsset->GetMaterialFunctors().size() == 1u);
PropertyDependencyTestFunctor* testFunctor = static_cast<PropertyDependencyTestFunctor*>(m_testMaterialAsset->GetMaterialFunctors()[0].get());
ErrorMessageFinder errorMessageFinder;
// Expect creation will call functor process once.
EXPECT_CALL(*testFunctor, ProcessCalled()).Times(1);
// Suppress 1 error as we know an unregistered dependent property will be accessed.
errorMessageFinder.Reset();
errorMessageFinder.AddExpectedErrorMessage("Material functor accessing an unregistered material property", 2);
Data::Instance<Material> material = Material::FindOrCreate(m_testMaterialAsset);
errorMessageFinder.CheckExpectedErrorsFound();
material->SetPropertyValue(material->FindPropertyIndex(registedPropertyName), int32_t(24));
// Expect dependent property change will call functor process once.
EXPECT_CALL(*testFunctor, ProcessCalled()).Times(1);
// Suppress 1 error as we know an unregistered dependent property will be accessed.
errorMessageFinder.Reset();
errorMessageFinder.AddExpectedErrorMessage("Material functor accessing an unregistered material property", 2);
material->Compile();
errorMessageFinder.CheckExpectedErrorsFound();
// Expect unrelated property change won't call functor process.
material->SetPropertyValue(material->FindPropertyIndex(unrelatedPropertyName), int32_t(24));
EXPECT_CALL(*testFunctor, ProcessCalled()).Times(0);
material->Compile();
m_testMaterialTypeAsset = {};
m_testMaterialAsset = {};
}
}
|
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Implementation of Jenkins one-at-a-time hash function. These choices are
* optimized for code size and portability, rather than raw speed. But speed
* should still be quite good.
**/
#include <stdlib.h>
#include <utils/JenkinsHash.h>
namespace android {
#ifdef __clang__
__attribute__((no_sanitize("integer")))
#endif
hash_t JenkinsHashWhiten(uint32_t hash) {
hash += (hash << 3);
hash ^= (hash >> 11);
hash += (hash << 15);
return hash;
}
uint32_t JenkinsHashMixBytes(uint32_t hash, const uint8_t* bytes, size_t size) {
if (size > UINT32_MAX) {
abort();
}
hash = JenkinsHashMix(hash, (uint32_t)size);
size_t i;
for (i = 0; i < (size & -4); i += 4) {
uint32_t data = bytes[i] | (bytes[i+1] << 8) | (bytes[i+2] << 16) | (bytes[i+3] << 24);
hash = JenkinsHashMix(hash, data);
}
if (size & 3) {
uint32_t data = bytes[i];
data |= ((size & 3) > 1) ? (bytes[i+1] << 8) : 0;
data |= ((size & 3) > 2) ? (bytes[i+2] << 16) : 0;
hash = JenkinsHashMix(hash, data);
}
return hash;
}
uint32_t JenkinsHashMixShorts(uint32_t hash, const uint16_t* shorts, size_t size) {
if (size > UINT32_MAX) {
abort();
}
hash = JenkinsHashMix(hash, (uint32_t)size);
size_t i;
for (i = 0; i < (size & -2); i += 2) {
uint32_t data = shorts[i] | (shorts[i+1] << 16);
hash = JenkinsHashMix(hash, data);
}
if (size & 1) {
uint32_t data = shorts[i];
hash = JenkinsHashMix(hash, data);
}
return hash;
}
}
|
// <IterableCollector.hpp> -*- C++ -*-
/*
*/
#ifndef __SPARTA_ITERABLE_OBJECT_COLLECTOR_HPP__
#define __SPARTA_ITERABLE_OBJECT_COLLECTOR_HPP__
#include <memory>
#include <sstream>
#include <string>
#include <vector>
#include <iterator>
#include <type_traits>
#include "sparta/utils/Utils.hpp"
#include "sparta/log/MessageSource.hpp"
#include "sparta/events/SchedulingPhases.hpp"
#include "sparta/collection/Collectable.hpp"
#include "sparta/collection/CollectableTreeNode.hpp"
#include "sparta/collection/PipelineCollector.hpp"
namespace sparta {
namespace collection {
/**
* \class IterableCollector
* \brief A collector of any iterable type (std::vector, std::list, sparta::Buffer, etc)
* \tname IterableType The type of the collected object
* \tname collection_phase The phase collection will occur.
* Collection happens automatically in this
* phase, unless it is disabled by a call to
* setManualCollection()
* \tname sparse_array_type Set to true if the iterable type is
* sparse, meaning iteration will occur on
* the entire iterable object, but each
* iterator might not be valid to
* de-reference. When this is true, it is
* expected that the iterator returned from
* the IterableType can be queried for
* validity (by a call to itr->isValid()).
*
* This collector will iterable over an std::array type, std::list
* type, std::vector type, sparta::Buffer, sparta::Queue, sparta::Array, or
* even a simple C-array type. The class needs to constructed with an
* expected capacity of the container, and the container should never
* grow beyond this expected capacity. If so, during collection, the
* class will output a warning message (only once).
*
* How collection is performed:
*
* - During the phase given by the template argument, this class will
* be given an opportunity to collect the object (convert the
* container's objects to a string using operator<<).
*
* - The main collection loop always iterates from 0 to the expected
* capacity, even if the \i size of the container is smaller. For
* every element in the collected object (begin() -> end()[size]),
* the object is collected. From end()[size] -> expected capacity,
* records are closed:
*
* <pre>
* | collected | closed |
* | begin -> end | end -> capacity |
* </pre>
*
* \note This Template Overload is switched on only for POD Data Types and/or Non-Pair-Collectable User Defined DataTypes.
*/
template <typename IterableType, SchedulingPhase collection_phase = SchedulingPhase::Collection, bool sparse_array_type = false>
class IterableCollector : public CollectableTreeNode
{
public:
typedef typename IterableType::size_type size_type;
/**
* \brief constructor
* \param parent the parent treenode for the collector
* \param name the name of the collector
* \param group Group this collector is part of
* \param index the index within the group
* \param desc Description of this node
* \param iterable the iterable object to collect
* \param expected_capacity The maximum size this item should grow to
*/
IterableCollector (TreeNode * parent,
const std::string & name,
const std::string & group,
const uint32_t index,
const std::string & desc,
const IterableType & iterable,
const size_type expected_capacity) :
CollectableTreeNode(parent, name, group, index, desc),
iterable_object_ (iterable),
expected_capacity_(expected_capacity),
event_set_(this),
ev_close_record_(&event_set_, name + "_pipeline_collectable_close_event",
CREATE_SPARTA_HANDLER_WITH_DATA(IterableCollector, closeRecord, bool))
{
for (size_type i = 0; i < expected_capacity_; ++i)
{
std::stringstream name_str;
name_str << name << i;
positions_.emplace_back(new CollectableT(this, name_str.str(), group, i));
}
}
/**
* \brief constructor
* \param parent the parent treenode for the collector
* \param name the name of the collector
* \param desc Description of this node
* \param iterable the iterable object to collect
* \param expected_capacity The maximum size this item should grow to
*/
IterableCollector (TreeNode * parent,
const std::string & name,
const std::string & desc,
const IterableType & iterable,
const size_type expected_capacity) :
IterableCollector(parent, name, name, 0, desc, iterable, expected_capacity)
{}
/**
* \brief constructor with no description
* \param parent the parent treenode for the collector
* \param name the name of the collector
* \param iterable the iterable object to collect
* \param expected_capacity The maximum size this item should grow to
*/
IterableCollector (TreeNode * parent,
const std::string & name,
const IterableType & iterable,
const size_type expected_capacity) :
IterableCollector (parent, name, name + " Iterable Collector",
iterable, expected_capacity)
{
// Delegated constructor
}
//! Collect the contents of the iterable object. This function
//! will walk starting from index 0 -> expected_capacity, clearing
//! out any records where the iterable object does not contain
//! data.
void collect () override
{
if (SPARTA_EXPECT_FALSE(isCollected()))
{
if(SPARTA_EXPECT_FALSE(iterable_object_.size() > expected_capacity_))
{
if(SPARTA_EXPECT_FALSE(warn_on_size_))
{
sparta::log::MessageSource::getGlobalWarn()
<< "WARNING! The collected object '"
<< getLocation() << "' has grown beyond the "
<< "expected capacity (given at construction) for collection. "
<< "Expected " << expected_capacity_ << " but grew to "
<< iterable_object_.size()
<< " This is your first and last warning.";
warn_on_size_ = false;
}
}
collectImpl_(std::integral_constant<bool, sparse_array_type>());
}
}
//! Force close all records for this iterable type. This will
//! close the record immediately and clear the field for the next
//! cycle
void closeRecord(const bool & simulation_ending = false) override {
for (size_type i = 0; i < positions_.size(); ++i) {
positions_[i]->closeRecord(simulation_ending);
}
}
//! \brief Do not perform any automatic collection
//! The SchedulingPhase is ignored
void setManualCollection() {
auto_collect_ = false;
}
//! \brief Perform a collection, then close the records in the future
//! \param duration The time to close the records, 0 is not allowed
void collectWithDuration(sparta::Clock::Cycle duration) {
if(SPARTA_EXPECT_FALSE(isCollected())) {
collect();
if(duration != 0) {
ev_close_record_.preparePayload(false)->schedule(duration);
}
}
}
private:
typedef Collectable<typename std::iterator_traits<typename IterableType::iterator>::value_type> CollectableT;
// Standard walk of iterable types
void collectImpl_(std::false_type)
{
auto itr = iterable_object_.begin();
auto eitr = iterable_object_.end();
for (uint32_t i = 0; i < expected_capacity_; ++i)
{
if (itr != eitr) {
positions_[i]->collect(*itr);
++itr;
} else {
positions_[i]->closeRecord();
}
}
}
// Full iteration walk, checking validity of the iterator. This
// is used for Pipe and Array where the iterator points to valid
// and not valid entries in the component
void collectImpl_(std::true_type)
{
uint32_t s = 0;
auto itr = iterable_object_.begin();
for (uint32_t i = 0; i < expected_capacity_; ++i, ++s)
{
if (itr.isValid()) {
positions_[i]->collect(*itr);
} else {
positions_[i]->closeRecord();
}
++itr;
}
}
//! Virtual method called by CollectableTreeNode when collection
//! is enabled on the TreeNode
void setCollecting_(bool collect, Collector * collector) override
{
PipelineCollector * pipeline_col = dynamic_cast<PipelineCollector *>(collector);
sparta_assert(pipeline_col != nullptr);
if(collect && auto_collect_) {
// Add this Collectable to the PipelineCollector's
// list of objects requiring collection
pipeline_col->addToAutoCollection(this, collection_phase);
}
else {
closeRecord();
}
}
const IterableType & iterable_object_;
std::vector<std::unique_ptr<CollectableT>> positions_;
const size_type expected_capacity_ = 0;
bool auto_collect_ = true;
bool warn_on_size_ = true;
// For those folks that want a value to automatically
// disappear in the future
sparta::EventSet event_set_;
sparta::PayloadEvent<bool, sparta::SchedulingPhase::Trigger> ev_close_record_;
};
} // namespace collection
} // namespace sparta
#endif
|
#include <AK/LogStream.h>
#include <AK/PrintfImplementation.h>
#include <AK/ScopedValueRollback.h>
#include <AK/StdLibExtras.h>
#include <Kernel/Syscall.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
extern "C" {
static FILE __default_streams[3];
FILE* stdin;
FILE* stdout;
FILE* stderr;
void init_FILE(FILE& fp, int fd, int mode)
{
fp.fd = fd;
fp.buffer = fp.default_buffer;
fp.buffer_size = BUFSIZ;
fp.mode = mode;
}
static FILE* make_FILE(int fd)
{
auto* fp = (FILE*)malloc(sizeof(FILE));
memset(fp, 0, sizeof(FILE));
init_FILE(*fp, fd, isatty(fd));
return fp;
}
void __stdio_init()
{
stdin = &__default_streams[0];
stdout = &__default_streams[1];
stderr = &__default_streams[2];
init_FILE(*stdin, 0, isatty(0) ? _IOLBF : _IOFBF);
init_FILE(*stdout, 1, isatty(1) ? _IOLBF : _IOFBF);
init_FILE(*stderr, 2, _IONBF);
}
int setvbuf(FILE* stream, char* buf, int mode, size_t size)
{
if (mode != _IONBF && mode != _IOLBF && mode != _IOFBF) {
errno = EINVAL;
return -1;
}
stream->mode = mode;
if (buf) {
stream->buffer = buf;
stream->buffer_size = size;
} else {
stream->buffer = stream->default_buffer;
stream->buffer_size = BUFSIZ;
}
stream->buffer_index = 0;
return 0;
}
void setbuf(FILE* stream, char* buf)
{
setvbuf(stream, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
}
void setlinebuf(FILE* stream)
{
setvbuf(stream, nullptr, _IOLBF, 0);
}
int fileno(FILE* stream)
{
assert(stream);
return stream->fd;
}
int feof(FILE* stream)
{
assert(stream);
return stream->eof;
}
int fflush(FILE* stream)
{
// FIXME: fflush(NULL) should flush all open output streams.
ASSERT(stream);
if (!stream->buffer_index)
return 0;
int rc = write(stream->fd, stream->buffer, stream->buffer_index);
stream->buffer_index = 0;
stream->error = 0;
stream->eof = 0;
stream->have_ungotten = false;
stream->ungotten = 0;
if (rc < 0) {
stream->error = errno;
return EOF;
}
return 0;
}
char* fgets(char* buffer, int size, FILE* stream)
{
ASSERT(stream);
ASSERT(size);
ssize_t nread = 0;
while (nread < (size - 1)) {
int ch = fgetc(stream);
if (ch == EOF)
break;
buffer[nread++] = ch;
if (ch == '\n')
break;
}
if (nread) {
buffer[nread] = '\0';
return buffer;
}
return nullptr;
}
int fgetc(FILE* stream)
{
assert(stream);
char ch;
size_t nread = fread(&ch, sizeof(char), 1, stream);
if (nread == 1)
return ch;
return EOF;
}
int getc(FILE* stream)
{
return fgetc(stream);
}
int getc_unlocked(FILE* stream)
{
return fgetc(stream);
}
int getchar()
{
return getc(stdin);
}
ssize_t getdelim(char** lineptr, size_t* n, int delim, FILE* stream)
{
char *ptr, *eptr;
if (*lineptr == nullptr || *n == 0) {
*n = BUFSIZ;
if ((*lineptr = static_cast<char*>(malloc(*n))) == nullptr) {
return -1;
}
}
for (ptr = *lineptr, eptr = *lineptr + *n;;) {
int c = fgetc(stream);
if (c == -1) {
if (feof(stream)) {
return ptr == *lineptr ? -1 : ptr - *lineptr;
} else {
return -1;
}
}
*ptr++ = c;
if (c == delim) {
*ptr = '\0';
return ptr - *lineptr;
}
if (ptr + 2 >= eptr) {
char* nbuf;
size_t nbuf_sz = *n * 2;
ssize_t d = ptr - *lineptr;
if ((nbuf = static_cast<char*>(realloc(*lineptr, nbuf_sz))) == nullptr) {
return -1;
}
*lineptr = nbuf;
*n = nbuf_sz;
eptr = nbuf + nbuf_sz;
ptr = nbuf + d;
}
}
}
ssize_t getline(char** lineptr, size_t* n, FILE* stream)
{
return getdelim(lineptr, n, '\n', stream);
}
int ungetc(int c, FILE* stream)
{
ASSERT(stream);
if (c == EOF)
return EOF;
if (stream->have_ungotten)
return EOF;
stream->have_ungotten = true;
stream->ungotten = c;
stream->eof = false;
return c;
}
int fputc(int ch, FILE* stream)
{
assert(stream);
assert(stream->buffer_index < stream->buffer_size);
stream->buffer[stream->buffer_index++] = ch;
if (stream->buffer_index >= stream->buffer_size)
fflush(stream);
else if (stream->mode == _IONBF || (stream->mode == _IOLBF && ch == '\n'))
fflush(stream);
if (stream->eof || stream->error)
return EOF;
return (u8)ch;
}
int putc(int ch, FILE* stream)
{
return fputc(ch, stream);
}
int putchar(int ch)
{
return putc(ch, stdout);
}
int fputs(const char* s, FILE* stream)
{
for (; *s; ++s) {
int rc = putc(*s, stream);
if (rc == EOF)
return EOF;
}
return 1;
}
int puts(const char* s)
{
int rc = fputs(s, stdout);
if (rc == EOF)
return EOF;
return fputc('\n', stdout);
}
void clearerr(FILE* stream)
{
assert(stream);
stream->eof = false;
stream->error = 0;
}
int ferror(FILE* stream)
{
return stream->error;
}
size_t fread(void* ptr, size_t size, size_t nmemb, FILE* stream)
{
assert(stream);
if (!size)
return 0;
ssize_t nread = 0;
if (stream->have_ungotten) {
// FIXME: Support ungotten character even if size != 1.
ASSERT(size == 1);
((char*)ptr)[0] = stream->ungotten;
stream->have_ungotten = false;
--nmemb;
if (!nmemb)
return 1;
ptr = &((char*)ptr)[1];
++nread;
}
ssize_t rc = read(stream->fd, ptr, nmemb * size);
if (rc < 0) {
stream->error = errno;
return 0;
}
if (rc == 0)
stream->eof = true;
nread += rc;
return nread / size;
}
size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE* stream)
{
assert(stream);
auto* bytes = (const u8*)ptr;
ssize_t nwritten = 0;
for (size_t i = 0; i < (size * nmemb); ++i) {
int rc = fputc(bytes[i], stream);
if (rc == EOF)
break;
++nwritten;
}
return nwritten / size;
}
int fseek(FILE* stream, long offset, int whence)
{
assert(stream);
fflush(stream);
off_t off = lseek(stream->fd, offset, whence);
if (off < 0)
return off;
stream->eof = false;
stream->error = 0;
stream->have_ungotten = false;
stream->ungotten = 0;
return 0;
}
long ftell(FILE* stream)
{
assert(stream);
fflush(stream);
return lseek(stream->fd, 0, SEEK_CUR);
}
void rewind(FILE* stream)
{
ASSERT(stream);
int rc = fseek(stream, 0, SEEK_SET);
ASSERT(rc == 0);
}
int dbgprintf(const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
int ret = printf_internal([](char*&, char ch) { dbgputch(ch); }, nullptr, fmt, ap);
va_end(ap);
return ret;
}
static void stdout_putch(char*&, char ch)
{
putchar(ch);
}
static FILE* __current_stream = nullptr;
static void stream_putch(char*&, char ch)
{
fputc(ch, __current_stream);
}
int vfprintf(FILE* stream, const char* fmt, va_list ap)
{
__current_stream = stream;
return printf_internal(stream_putch, nullptr, fmt, ap);
}
int fprintf(FILE* stream, const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
int ret = vfprintf(stream, fmt, ap);
va_end(ap);
return ret;
}
int vprintf(const char* fmt, va_list ap)
{
return printf_internal(stdout_putch, nullptr, fmt, ap);
}
int printf(const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
int ret = vprintf(fmt, ap);
va_end(ap);
return ret;
}
static void buffer_putch(char*& bufptr, char ch)
{
*bufptr++ = ch;
}
int vsprintf(char* buffer, const char* fmt, va_list ap)
{
int ret = printf_internal(buffer_putch, buffer, fmt, ap);
buffer[ret] = '\0';
return ret;
}
int sprintf(char* buffer, const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
int ret = vsprintf(buffer, fmt, ap);
va_end(ap);
return ret;
}
static size_t __vsnprintf_space_remaining;
static void sized_buffer_putch(char*& bufptr, char ch)
{
if (__vsnprintf_space_remaining) {
*bufptr++ = ch;
--__vsnprintf_space_remaining;
}
}
int vsnprintf(char* buffer, size_t size, const char* fmt, va_list ap)
{
__vsnprintf_space_remaining = size;
int ret = printf_internal(sized_buffer_putch, buffer, fmt, ap);
if (__vsnprintf_space_remaining) {
buffer[ret] = '\0';
}
return ret;
}
int snprintf(char* buffer, size_t size, const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
int ret = vsnprintf(buffer, size, fmt, ap);
va_end(ap);
return ret;
}
void perror(const char* s)
{
int saved_errno = errno;
dbg() << "perror(): " << s << ": " << strerror(saved_errno);
fprintf(stderr, "%s: %s\n", s, strerror(saved_errno));
}
FILE* fopen(const char* pathname, const char* mode)
{
int flags = 0;
// NOTE: rt is a non-standard mode which opens a file for read, explicitly
// specifying that it's a text file
if (!strcmp(mode, "r") || !strcmp(mode, "rb") || !strcmp(mode, "rt"))
flags = O_RDONLY;
else if (!strcmp(mode, "r+") || !strcmp(mode, "rb+"))
flags = O_RDWR;
else if (!strcmp(mode, "w") || !strcmp(mode, "wb"))
flags = O_WRONLY | O_CREAT | O_TRUNC;
else if (!strcmp(mode, "w+") || !strcmp(mode, "wb+"))
flags = O_RDWR | O_CREAT | O_TRUNC;
else {
fprintf(stderr, "FIXME(LibC): fopen('%s', '%s')\n", pathname, mode);
ASSERT_NOT_REACHED();
}
int fd = open(pathname, flags, 0666);
if (fd < 0)
return nullptr;
return make_FILE(fd);
}
FILE* freopen(const char* pathname, const char* mode, FILE* stream)
{
(void)pathname;
(void)mode;
(void)stream;
ASSERT_NOT_REACHED();
}
FILE* fdopen(int fd, const char* mode)
{
UNUSED_PARAM(mode);
// FIXME: Verify that the mode matches how fd is already open.
if (fd < 0)
return nullptr;
return make_FILE(fd);
}
int fclose(FILE* stream)
{
fflush(stream);
int rc = close(stream->fd);
if (stream != &__default_streams[0] && stream != &__default_streams[1] && stream != &__default_streams[2])
free(stream);
return rc;
}
int rename(const char* oldpath, const char* newpath)
{
int rc = syscall(SC_rename, oldpath, newpath);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
void dbgputch(char ch)
{
syscall(SC_dbgputch, ch);
}
int dbgputstr(const char* characters, int length)
{
int rc = syscall(SC_dbgputstr, characters, length);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
char* tmpnam(char*)
{
ASSERT_NOT_REACHED();
}
FILE* popen(const char* command, const char* type)
{
if (!type || (*type != 'r' && *type != 'w')) {
errno = EINVAL;
return nullptr;
}
int pipe_fds[2];
int rc = pipe(pipe_fds);
if (rc < 0) {
ScopedValueRollback rollback(errno);
perror("pipe");
return nullptr;
}
pid_t child_pid = fork();
if (!child_pid) {
if (*type == 'r') {
int rc = dup2(pipe_fds[1], STDOUT_FILENO);
if (rc < 0) {
perror("dup2");
exit(1);
}
close(pipe_fds[0]);
close(pipe_fds[1]);
} else if (*type == 'w') {
int rc = dup2(pipe_fds[0], STDIN_FILENO);
if (rc < 0) {
perror("dup2");
exit(1);
}
close(pipe_fds[0]);
close(pipe_fds[1]);
}
int rc = execl("/bin/sh", "sh", "-c", command, nullptr);
if (rc < 0)
perror("execl");
exit(1);
}
FILE* fp = nullptr;
if (*type == 'r') {
fp = make_FILE(pipe_fds[0]);
close(pipe_fds[1]);
} else if (*type == 'w') {
fp = make_FILE(pipe_fds[1]);
close(pipe_fds[0]);
}
fp->popen_child = child_pid;
return fp;
}
int pclose(FILE* fp)
{
ASSERT(fp);
ASSERT(fp->popen_child != 0);
int wstatus = 0;
int rc = waitpid(fp->popen_child, &wstatus, 0);
if (rc < 0)
return rc;
return wstatus;
}
int remove(const char* pathname)
{
int rc = unlink(pathname);
if (rc < 0 && errno != EISDIR)
return -1;
return rmdir(pathname);
}
int scanf(const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
int count = vfscanf(stdin, fmt, ap);
va_end(ap);
return count;
}
int fscanf(FILE* stream, const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
int count = vfscanf(stream, fmt, ap);
va_end(ap);
return count;
}
int sscanf(const char* buffer, const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
int count = vsscanf(buffer, fmt, ap);
va_end(ap);
return count;
}
int vfscanf(FILE* stream, const char* fmt, va_list ap)
{
char buffer[BUFSIZ];
if (!fgets(buffer, sizeof(buffer) - 1, stream))
return -1;
return vsscanf(buffer, fmt, ap);
}
void flockfile(FILE* filehandle)
{
(void)filehandle;
dbgprintf("FIXME: Implement flockfile()\n");
}
void funlockfile(FILE* filehandle)
{
(void)filehandle;
dbgprintf("FIXME: Implement funlockfile()\n");
}
FILE* tmpfile()
{
dbgprintf("FIXME: Implement tmpfile()\n");
ASSERT_NOT_REACHED();
}
}
|
// Copyright (c) 2015-2018 Daniel Cooke
// Use of this source code is governed by the MIT license that can be found in the LICENSE file.
#include "population_caller.hpp"
#include <typeinfo>
#include <unordered_map>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <utility>
#include <iostream>
#include "basics/genomic_region.hpp"
#include "core/types/allele.hpp"
#include "core/types/variant.hpp"
#include "core/types/haplotype.hpp"
#include "core/types/genotype.hpp"
#include "utils/maths.hpp"
#include "utils/mappable_algorithms.hpp"
#include "utils/read_stats.hpp"
#include "containers/probability_matrix.hpp"
#include "core/models/genotype/individual_model.hpp"
#include "core/models/genotype/uniform_population_prior_model.hpp"
#include "core/models/genotype/coalescent_population_prior_model.hpp"
#include "core/models/genotype/uniform_genotype_prior_model.hpp"
#include "core/models/genotype/coalescent_genotype_prior_model.hpp"
#include "logging/logging.hpp"
#include "core/types/calls/germline_variant_call.hpp"
#include "core/types/calls/reference_call.hpp"
namespace octopus {
template <typename Container>
bool all_equal(const Container& c)
{
return std::adjacent_find(std::cbegin(c), std::cend(c), std::not_equal_to<typename Container::value_type> {}) == std::cend(c);
}
PopulationCaller::PopulationCaller(Caller::Components&& components,
Caller::Parameters general_parameters,
Parameters specific_parameters)
: Caller {std::move(components), std::move(general_parameters)}
, parameters_ {specific_parameters}
{
if (all_equal(parameters_.ploidies)) {
parameters_.ploidies.resize(1);
}
}
std::string PopulationCaller::do_name() const
{
return "population";
}
PopulationCaller::CallTypeSet PopulationCaller::do_call_types() const
{
return {std::type_index(typeid(GermlineVariantCall))};
}
unsigned PopulationCaller::do_min_callable_ploidy() const
{
return *std::min_element(std::cbegin(parameters_.ploidies), std::cend(parameters_.ploidies));
}
unsigned PopulationCaller::do_max_callable_ploidy() const
{
return *std::max_element(std::cbegin(parameters_.ploidies), std::cend(parameters_.ploidies));
}
std::size_t PopulationCaller::do_remove_duplicates(std::vector<Haplotype>& haplotypes) const
{
if (parameters_.deduplicate_haplotypes_with_germline_model) {
if (haplotypes.size() < 2) return 0;
CoalescentModel::Parameters model_params {};
if (parameters_.prior_model_params) model_params = *parameters_.prior_model_params;
Haplotype reference {mapped_region(haplotypes.front()), reference_.get()};
CoalescentModel model {std::move(reference), model_params, haplotypes.size(), CoalescentModel::CachingStrategy::none};
const CoalescentProbabilityGreater cmp {std::move(model)};
return octopus::remove_duplicates(haplotypes, cmp);
} else {
return Caller::do_remove_duplicates(haplotypes);
}
}
// IndividualCaller::Latents public methods
namespace {
using InverseGenotypeTable = std::vector<std::vector<std::size_t>>;
auto make_inverse_genotype_table(const std::vector<Haplotype>& haplotypes,
const std::vector<Genotype<Haplotype>>& genotypes)
{
assert(!haplotypes.empty() && !genotypes.empty());
using HaplotypeReference = std::reference_wrapper<const Haplotype>;
std::unordered_map<HaplotypeReference, std::vector<std::size_t>> result_map {haplotypes.size()};
const auto cardinality = element_cardinality_in_genotypes(static_cast<unsigned>(haplotypes.size()),
genotypes.front().ploidy());
for (const auto& haplotype : haplotypes) {
auto itr = result_map.emplace(std::piecewise_construct,
std::forward_as_tuple(std::cref(haplotype)),
std::forward_as_tuple());
itr.first->second.reserve(cardinality);
}
for (std::size_t i {0}; i < genotypes.size(); ++i) {
for (const auto& haplotype : genotypes[i]) {
result_map.at(haplotype).emplace_back(i);
}
}
InverseGenotypeTable result {};
result.reserve(haplotypes.size());
for (const auto& haplotype : haplotypes) {
auto& indices = result_map.at(haplotype);
std::sort(std::begin(indices), std::end(indices));
indices.erase(std::unique(std::begin(indices), std::end(indices)), std::end(indices));
result.emplace_back(std::move(indices));
}
return result;
}
using GM = model::PopulationModel;
using GenotypeMarginalPosteriorVector = std::vector<double>;
using GenotypeMarginalPosteriorMatrix = std::vector<GenotypeMarginalPosteriorVector>;
auto calculate_haplotype_posteriors(const std::vector<Haplotype>& haplotypes,
const std::vector<Genotype<Haplotype>>& genotypes,
const GenotypeMarginalPosteriorMatrix& genotype_posteriors,
const InverseGenotypeTable& inverse_genotypes)
{
std::unordered_map<std::reference_wrapper<const Haplotype>, double> result {haplotypes.size()};
auto itr = std::cbegin(inverse_genotypes);
std::vector<std::size_t> genotype_indices(genotypes.size());
std::iota(std::begin(genotype_indices), std::end(genotype_indices), 0);
// noncontaining genotypes are genotypes that do not contain a particular haplotype.
const auto num_noncontaining_genotypes = genotypes.size() - itr->size();
std::vector<std::size_t> noncontaining_genotype_indices(num_noncontaining_genotypes);
for (const auto& haplotype : haplotypes) {
std::set_difference(std::cbegin(genotype_indices), std::cend(genotype_indices),
std::cbegin(*itr), std::cend(*itr),
std::begin(noncontaining_genotype_indices));
double prob_not_observed {1};
for (const auto& sample_genotype_posteriors : genotype_posteriors) {
prob_not_observed *= std::accumulate(std::cbegin(noncontaining_genotype_indices),
std::cend(noncontaining_genotype_indices),
0.0, [&sample_genotype_posteriors]
(const auto curr, const auto i) {
return curr + sample_genotype_posteriors[i];
});
}
result.emplace(haplotype, 1.0 - prob_not_observed);
++itr;
}
return result;
}
} // namespace
PopulationCaller::Latents::Latents(const std::vector<SampleName>& samples,
const std::vector<Haplotype>& haplotypes,
std::vector<Genotype<Haplotype>>&& genotypes,
IndependenceModelInferences&& inferences)
{
auto inverse_genotypes = make_inverse_genotype_table(haplotypes, genotypes);
auto& genotype_marginal_posteriors = inferences.posteriors.genotype_probabilities;
haplotype_posteriors_ = std::make_shared<HaplotypeProbabilityMap>(calculate_haplotype_posteriors(haplotypes, genotypes, genotype_marginal_posteriors, inverse_genotypes));
GenotypeProbabilityMap genotype_posteriors {std::begin(genotypes), std::end(genotypes)};
for (std::size_t s {0}; s < samples.size(); ++s) {
insert_sample(samples[s], std::move(genotype_marginal_posteriors[s]), genotype_posteriors);
}
genotype_posteriors_ = std::make_shared<GenotypeProbabilityMap>(std::move(genotype_posteriors));
genotypes_.emplace(genotypes.front().ploidy(), std::move(genotypes));
}
PopulationCaller::Latents::Latents(const std::vector<SampleName>& samples,
const std::vector<Haplotype>& haplotypes,
std::unordered_map<unsigned, std::vector<Genotype<Haplotype>>>&& genotypes,
IndependenceModelInferences&& inferences)
: genotypes_ {std::move(genotypes)}
{
}
PopulationCaller::Latents::Latents(const std::vector<SampleName>& samples,
const std::vector<Haplotype>& haplotypes,
std::vector<Genotype<Haplotype>>&& genotypes,
ModelInferences&& inferences)
: model_latents_ {std::move(inferences)}
{
auto inverse_genotypes = make_inverse_genotype_table(haplotypes, genotypes);
haplotype_posteriors_ = std::make_shared<HaplotypeProbabilityMap>(calculate_haplotype_posteriors(haplotypes, genotypes,
model_latents_.posteriors.marginal_genotype_probabilities,
inverse_genotypes));
GenotypeProbabilityMap genotype_posteriors {std::begin(genotypes), std::end(genotypes)};
for (std::size_t s {0}; s < samples.size(); ++s) {
insert_sample(samples[s], model_latents_.posteriors.marginal_genotype_probabilities[s], genotype_posteriors);
}
genotype_posteriors_ = std::make_shared<GenotypeProbabilityMap>(std::move(genotype_posteriors));
genotypes_.emplace(genotypes.front().ploidy(), std::move(genotypes));
}
PopulationCaller::Latents::Latents(const std::vector<SampleName>& samples,
const std::vector<Haplotype>& haplotypes,
std::unordered_map<unsigned, std::vector<Genotype<Haplotype>>>&& genotypes,
ModelInferences&& inferences)
: genotypes_ {std::move(genotypes)}
, model_latents_ {std::move(inferences)}
{
}
std::shared_ptr<PopulationCaller::Latents::HaplotypeProbabilityMap>
PopulationCaller::Latents::haplotype_posteriors() const noexcept
{
return haplotype_posteriors_;
}
std::shared_ptr<PopulationCaller::Latents::GenotypeProbabilityMap>
PopulationCaller::Latents::genotype_posteriors() const noexcept
{
return genotype_posteriors_;
}
using GenotypesMap = std::unordered_map<unsigned, std::vector<Genotype<Haplotype>>>;
auto generate_unique_genotypes(const std::vector<Haplotype>& haplotypes, std::vector<unsigned> ploidies)
{
std::sort(std::begin(ploidies), std::end(ploidies));
ploidies.erase(std::unique(std::begin(ploidies), std::end(ploidies)), std::end(ploidies));
GenotypesMap result {ploidies.size()};
for (auto ploidy : ploidies) {
result.emplace(ploidy, generate_all_genotypes(haplotypes, ploidy));
}
return result;
}
using GenotypeVectorReference = std::reference_wrapper<const std::vector<Genotype<Haplotype>>>;
auto assign_samples_to_genotypes(std::vector<unsigned> ploidies, const GenotypesMap& genotypes)
{
std::vector<GenotypeVectorReference> result {};
result.reserve(ploidies.size());
for (auto ploidy : ploidies) {
result.emplace_back(genotypes.at(ploidy));
}
return result;
}
std::unique_ptr<PopulationCaller::Caller::Latents>
PopulationCaller::infer_latents(const std::vector<Haplotype>& haplotypes,
const HaplotypeLikelihoodArray& haplotype_likelihoods) const
{
if (use_independence_model()) {
return infer_latents_with_independence_model(haplotypes, haplotype_likelihoods);
} else {
return infer_latents_with_joint_model(haplotypes, haplotype_likelihoods);
}
}
//auto calculate_model_posterior(const double normal_model_log_evidence,
// const double dummy_model_log_evidence)
//{
// constexpr double normal_model_prior {0.9999999};
// constexpr double dummy_model_prior {1.0 - normal_model_prior};
//
// const auto normal_model_ljp = std::log(normal_model_prior) + normal_model_log_evidence;
// const auto dummy_model_ljp = std::log(dummy_model_prior) + dummy_model_log_evidence;
//
// const auto norm = maths::log_sum_exp(normal_model_ljp, dummy_model_ljp);
//
// return std::exp(dummy_model_ljp - norm);
//}
//namespace debug {
//
//template <typename S>
//void print_genotype_posteriors(S&& stream, const GenotypeProbabilityMap& genotype_posteriors,
// std::size_t n = 5);
//void print_genotype_posteriors(const GenotypeProbabilityMap& genotype_posteriors,
// std::size_t n = 5);
//template <typename S>
//void print_candidate_posteriors(S&& stream, const VariantPosteriors& candidate_posteriors,
// std::size_t n = 10);
//void print_candidate_posteriors(const VariantPosteriors& candidate_posteriors,
// std::size_t n = 10);
//void print_variant_calls(const VariantCallBlocks& calls);
//
//} // namespace debug
std::vector<std::unique_ptr<octopus::VariantCall>>
PopulationCaller::call_variants(const std::vector<Variant>& candidates, const Caller::Latents& latents) const
{
return call_variants(candidates, dynamic_cast<const Latents&>(latents));
}
namespace {
using GenotypeProbabilityMap = ProbabilityMatrix<Genotype<Haplotype>>::InnerMap;
using PopulationGenotypeProbabilityMap = ProbabilityMatrix<Genotype<Haplotype>>;
using VariantReference = std::reference_wrapper<const Variant>;
using VariantPosteriorVector = std::vector<std::pair<VariantReference, std::vector<Phred<double>>>>;
struct VariantCall : Mappable<VariantCall>
{
VariantCall() = delete;
VariantCall(const std::pair<VariantReference, std::vector<Phred<double>>>& p)
: variant {p.first}
, posteriors {p.second}
{}
VariantCall(const Variant& variant, std::vector<Phred<double>> posterior)
: variant {variant}
, posteriors {posterior}
{}
const GenomicRegion& mapped_region() const noexcept
{
return octopus::mapped_region(variant.get());
}
VariantReference variant;
std::vector<Phred<double>> posteriors;
};
using VariantCalls = std::vector<VariantCall>;
struct GenotypeCall
{
Genotype<Allele> genotype;
Phred<double> posterior;
};
using GenotypeCalls = std::vector<std::vector<GenotypeCall>>;
// allele posterior calculations
using AlleleBools = std::deque<bool>; // using std::deque because std::vector<bool> is evil
using GenotypePropertyBools = std::vector<AlleleBools>;
auto marginalise(const GenotypeProbabilityMap& genotype_posteriors,
const AlleleBools& contained_alleles)
{
auto p = std::inner_product(std::cbegin(genotype_posteriors), std::cend(genotype_posteriors),
std::cbegin(contained_alleles), 0.0, std::plus<> {},
[] (const auto& p, const bool is_contained) {
return is_contained ? 0.0 : p.second;
});
return probability_to_phred(p);
}
auto compute_sample_allele_posteriors(const GenotypeProbabilityMap& genotype_posteriors,
const GenotypePropertyBools& contained_alleles)
{
std::vector<Phred<double>> result {};
result.reserve(contained_alleles.size());
for (const auto& allele : contained_alleles) {
result.emplace_back(marginalise(genotype_posteriors, allele));
}
return result;
}
auto get_contained_alleles(const PopulationGenotypeProbabilityMap& genotype_posteriors,
const std::vector<Allele>& alleles)
{
const auto num_genotypes = genotype_posteriors.size2();
GenotypePropertyBools result {};
if (num_genotypes == 0 || genotype_posteriors.empty1() || alleles.empty()) {
return result;
}
result.reserve(alleles.size());
const auto& test_sample = genotype_posteriors.begin()->first;
const auto genotype_begin = genotype_posteriors.begin(test_sample);
const auto genotype_end = genotype_posteriors.end(test_sample);
for (const auto& allele : alleles) {
result.emplace_back(num_genotypes);
std::transform(genotype_begin, genotype_end, std::begin(result.back()),
[&] (const auto& p) { return contains(p.first, allele); });
}
return result;
}
auto compute_posteriors(const std::vector<SampleName>& samples,
const std::vector<Allele>& alleles,
const PopulationGenotypeProbabilityMap& genotype_posteriors)
{
const auto contained_alleles = get_contained_alleles(genotype_posteriors, alleles);
std::vector<std::vector<Phred<double>>> result {};
result.reserve(genotype_posteriors.size1());
for (const auto& sample : samples) {
result.emplace_back(compute_sample_allele_posteriors(genotype_posteriors[sample], contained_alleles));
}
return result;
}
auto extract_ref_alleles(const std::vector<Variant>& variants)
{
std::vector<Allele> result {};
result.reserve(variants.size());
std::transform(std::cbegin(variants), std::cend(variants), std::back_inserter(result),
[] (const auto& variant) { return variant.ref_allele(); });
return result;
}
auto extract_alt_alleles(const std::vector<Variant>& variants)
{
std::vector<Allele> result {};
result.reserve(variants.size());
std::transform(std::cbegin(variants), std::cend(variants), std::back_inserter(result),
[] (const auto& variant) { return variant.alt_allele(); });
return result;
}
auto compute_posteriors(const std::vector<SampleName>& samples,
const std::vector<Variant>& variants,
const PopulationGenotypeProbabilityMap& genotype_posteriors)
{
const auto allele_posteriors = compute_posteriors(samples, extract_alt_alleles(variants), genotype_posteriors);
VariantPosteriorVector result {};
result.reserve(variants.size());
for (std::size_t i {0}; i < variants.size(); ++i) {
std::vector<Phred<double>> sample_posteriors(samples.size());
std::transform(std::cbegin(allele_posteriors), std::cend(allele_posteriors), std::begin(sample_posteriors),
[i] (const auto& ps) { return ps[i]; });
result.emplace_back(variants[i], std::move(sample_posteriors));
}
return result;
}
// haplotype genotype calling
//auto call_genotypes(const GM::Latents& latents, const std::vector<Genotype<Haplotype>>& genotypes)
//{
// const auto itr = std::max_element(std::cbegin(latents.joint_genotype_probabilities), std::cend(latents.joint_genotype_probabilities));
// const auto& called_indices = latents.genotype_combinations[std::distance(std::cbegin(latents.joint_genotype_probabilities), itr)];
// std::vector<Genotype<Haplotype>> result {};
// result.reserve(called_indices.size());
// std::transform(std::cbegin(called_indices), std::cend(called_indices), std::back_inserter(result),
// [&] (auto idx) { return genotypes[idx]; });
// return result;
//}
//
//auto call_genotypes(const GM::Latents& latents, const std::unordered_map<unsigned, std::vector<Genotype<Haplotype>>>& genotypes)
//{
// return call_genotypes(latents, std::cbegin(genotypes)->second);
//}
auto call_genotype(const PopulationGenotypeProbabilityMap::InnerMap& genotype_posteriors)
{
return std::max_element(std::cbegin(genotype_posteriors), std::cend(genotype_posteriors),
[] (const auto& lhs, const auto& rhs) { return lhs.second < rhs.second; })->first;
}
auto call_genotypes(const std::vector<SampleName>& samples, const PopulationGenotypeProbabilityMap& genotype_posteriors)
{
std::vector<Genotype<Haplotype>> result {};
result.reserve(samples.size());
for (const auto& sample : samples) {
result.push_back(call_genotype(genotype_posteriors[sample]));
}
return result;
}
// variant calling
bool has_above(const std::vector<Phred<double>>& posteriors, const Phred<double> min_posterior)
{
return std::any_of(std::cbegin(posteriors), std::cend(posteriors), [=] (auto p) { return p >= min_posterior; });
}
bool contains_alt(const Genotype<Haplotype>& genotype_call, const VariantReference& candidate)
{
return includes(genotype_call, candidate.get().alt_allele());
}
bool contains_alt(const std::vector<Genotype<Haplotype>>& genotype_calls, const VariantReference& candidate)
{
return std::any_of(std::cbegin(genotype_calls), std::cend(genotype_calls),
[&] (const auto& genotype) { return contains_alt(genotype, candidate); });
}
VariantCalls call_candidates(const VariantPosteriorVector& candidate_posteriors,
const std::vector<Genotype<Haplotype>>& genotype_calls,
const Phred<double> min_posterior)
{
VariantCalls result {};
result.reserve(candidate_posteriors.size());
std::copy_if(std::cbegin(candidate_posteriors), std::cend(candidate_posteriors),
std::back_inserter(result),
[&genotype_calls, min_posterior] (const auto& p) {
return has_above(p.second, min_posterior) && contains_alt(genotype_calls, p.first);
});
return result;
}
// polymorphism calculations
auto get_homozygous_alleles(const PopulationGenotypeProbabilityMap& genotype_posteriors,
const std::vector<Allele>& alleles)
{
const auto num_genotypes = genotype_posteriors.size2();
GenotypePropertyBools result {};
if (num_genotypes == 0 || genotype_posteriors.empty1() || alleles.empty()) {
return result;
}
result.reserve(alleles.size());
const auto& test_sample = genotype_posteriors.begin()->first;
const auto genotype_begin = genotype_posteriors.begin(test_sample);
const auto genotype_end = genotype_posteriors.end(test_sample);
for (const auto& allele : alleles) {
result.emplace_back(num_genotypes);
std::transform(genotype_begin, genotype_end, std::begin(result.back()),
[&] (const auto& p) { return is_homozygous(p.first, allele); });
}
return result;
}
auto marginalise_homozygous(const GenotypeProbabilityMap& genotype_posteriors,
const AlleleBools& homozygotes)
{
return std::inner_product(std::cbegin(genotype_posteriors), std::cend(genotype_posteriors),
std::cbegin(homozygotes), 0.0, std::plus<> {},
[] (const auto& p, const bool is_homozygous) {
return is_homozygous ? p.second : 0.0;
});
}
auto marginalise_homozygous(const std::vector<SampleName>& samples,
const PopulationGenotypeProbabilityMap& genotype_posteriors,
const AlleleBools& homozygotes)
{
std::vector<double> ps(samples.size());
std::transform(std::cbegin(samples), std::cend(samples), std::begin(ps),
[&] (const auto& sample) {
return std::log(marginalise_homozygous(genotype_posteriors[sample], homozygotes));
});
const auto p = std::accumulate(std::cbegin(ps), std::cend(ps), 0.0);
return probability_to_phred(std::exp(p));
}
auto compute_homozygous_posteriors(const std::vector<Allele>& alleles,
const std::vector<SampleName>& samples,
const PopulationGenotypeProbabilityMap& genotype_posteriors)
{
const auto homozygous_alleles = get_homozygous_alleles(genotype_posteriors, alleles);
std::vector<Phred<double>> result(alleles.size());
std::transform(std::cbegin(alleles), std::cend(alleles), std::cbegin(homozygous_alleles), std::begin(result),
[&] (const auto& allele, const auto& homozygotes) {
return marginalise_homozygous(samples, genotype_posteriors, homozygotes);
});
return result;
}
auto compute_polymorphism_posteriors(const std::vector<Variant>& variants,
const std::vector<SampleName>& samples,
const PopulationGenotypeProbabilityMap& genotype_posteriors)
{
return compute_homozygous_posteriors(extract_ref_alleles(variants), samples, genotype_posteriors);
}
// allele genotype calling
auto marginalise(const Genotype<Allele>& genotype, const GenotypeProbabilityMap& genotype_posteriors)
{
auto p = std::accumulate(std::cbegin(genotype_posteriors), std::cend(genotype_posteriors), 0.0,
[&genotype] (const double curr, const auto& p) {
return curr + (contains(p.first, genotype) ? 0.0 : p.second);
});
return probability_to_phred(p);
}
auto call_genotypes(const std::vector<SampleName>& samples,
const std::vector<Genotype<Haplotype>>& genotype_calls,
const PopulationGenotypeProbabilityMap& genotype_posteriors,
const std::vector<GenomicRegion>& variant_regions)
{
GenotypeCalls result {};
result.reserve(variant_regions.size());
for (const auto& region : variant_regions) {
std::vector<GenotypeCall> region_calls {};
region_calls.reserve(samples.size());
for (std::size_t s {0}; s < samples.size(); ++s) {
auto genotype_chunk = copy<Allele>(genotype_calls[s], region);
const auto posterior = marginalise(genotype_chunk, genotype_posteriors[samples[s]]);
region_calls.push_back({std::move(genotype_chunk), posterior});
}
result.push_back(std::move(region_calls));
}
return result;
}
// output
octopus::VariantCall::GenotypeCall convert(GenotypeCall&& call)
{
return octopus::VariantCall::GenotypeCall {std::move(call.genotype), call.posterior};
}
auto max(const std::vector<Phred<double>>& posteriors)
{
return *std::max_element(std::cbegin(posteriors), std::cend(posteriors));
}
std::unique_ptr<octopus::VariantCall>
transform_call(const std::vector<SampleName>& samples,
VariantCall&& variant_call,
std::vector<GenotypeCall>&& sample_genotype_calls)
{
std::vector<std::pair<SampleName, Call::GenotypeCall>> tmp {};
tmp.reserve(samples.size());
std::transform(std::cbegin(samples), std::cend(samples),
std::make_move_iterator(std::begin(sample_genotype_calls)),
std::back_inserter(tmp),
[] (const auto& sample, auto&& genotype) {
return std::make_pair(sample, convert(std::move(genotype)));
});
auto p = std::accumulate(std::cbegin(variant_call.posteriors), std::cend(variant_call.posteriors), 0.0,
[] (auto curr, auto x) { return curr + x.score(); });
return std::make_unique<GermlineVariantCall>(variant_call.variant.get(), std::move(tmp), Phred<> {p});
}
auto transform_calls(const std::vector<SampleName>& samples,
VariantCalls&& variant_calls,
GenotypeCalls&& genotype_calls)
{
std::vector<std::unique_ptr<octopus::VariantCall>> result {};
result.reserve(variant_calls.size());
std::transform(std::make_move_iterator(std::begin(variant_calls)), std::make_move_iterator(std::end(variant_calls)),
std::make_move_iterator(std::begin(genotype_calls)), std::back_inserter(result),
[&samples] (auto&& variant_call, auto&& genotype_call) {
return transform_call(samples, std::move(variant_call), std::move(genotype_call));
});
return result;
}
} // namespace
namespace debug {
void log(const PopulationGenotypeProbabilityMap& genotype_posteriors,
boost::optional<logging::DebugLogger>& debug_log,
boost::optional<logging::TraceLogger>& trace_log);
void log(const VariantPosteriorVector& candidate_posteriors,
boost::optional<logging::DebugLogger>& debug_log,
boost::optional<logging::TraceLogger>& trace_log);
void log(const Genotype<Haplotype>& called_genotype,
boost::optional<logging::DebugLogger>& debug_log);
} // namespace debug
std::vector<std::unique_ptr<octopus::VariantCall>>
PopulationCaller::call_variants(const std::vector<Variant>& candidates, const Latents& latents) const
{
const auto& genotype_posteriors = *latents.genotype_posteriors_;
debug::log(genotype_posteriors, debug_log_, trace_log_);
const auto candidate_posteriors = compute_posteriors(samples_, candidates, genotype_posteriors);
debug::log(candidate_posteriors, debug_log_, trace_log_);
const auto genotype_calls = call_genotypes(samples_, genotype_posteriors);
auto variant_calls = call_candidates(candidate_posteriors, genotype_calls, parameters_.min_variant_posterior);
const auto called_regions = extract_regions(variant_calls);
auto allele_genotype_calls = call_genotypes(samples_, genotype_calls, genotype_posteriors, called_regions);
return transform_calls(samples_, std::move(variant_calls), std::move(allele_genotype_calls));
}
namespace {
// reference genotype calling
struct RefCall : public Mappable<RefCall>
{
RefCall() = default;
template <typename A>
RefCall(A&& reference_allele, double posterior)
: reference_allele {std::forward<A>(reference_allele)}
, posterior {posterior}
{}
const GenomicRegion& mapped_region() const noexcept { return reference_allele.mapped_region(); }
Allele reference_allele;
double posterior;
};
using RefCalls = std::vector<RefCall>;
// double marginalise_reference_genotype(const Allele& reference_allele,
// const GenotypeProbabilityMap& sample_genotype_posteriors)
// {
// double result {0};
//
// for (const auto& genotype_posterior : sample_genotype_posteriors) {
// if (is_homozygous(genotype_posterior.first, reference_allele)) {
// result += genotype_posterior.second;
// }
// }
//
// return result;
// }
// RefCalls call_reference(const GenotypeProbabilityMap& genotype_posteriors,
// const std::vector<Allele>& reference_alleles,
// const ReadMap::mapped_type& reads, const double min_call_posterior)
// {
// RefCalls result {};
//
// if (reference_alleles.empty()) return result;
//
// result.reserve(reference_alleles.size());
//
// for (const auto& reference_allele : reference_alleles) {
// double posterior {0};
//
// if (has_coverage(reads, mapped_region(reference_allele))) {
// posterior = marginalise_reference_genotype(reference_allele,
// genotype_posteriors);
// }
//
// if (posterior >= min_call_posterior) {
// result.emplace_back(reference_allele, posterior);
// }
// }
//
// result.shrink_to_fit();
//
// return result;
// }
} // namespace
std::vector<std::unique_ptr<ReferenceCall>>
PopulationCaller::call_reference(const std::vector<Allele>& alleles,
const Caller::Latents& latents,
const ReadPileupMap& pileups) const
{
return {};
}
bool PopulationCaller::use_independence_model() const noexcept
{
return parameters_.use_independent_genotype_priors || !parameters_.prior_model_params;
}
std::unique_ptr<Caller::Latents>
PopulationCaller::infer_latents_with_joint_model(const std::vector<Haplotype>& haplotypes,
const HaplotypeLikelihoodArray& haplotype_likelihoods) const
{
const auto prior_model = make_joint_prior_model(haplotypes);
prior_model->prime(haplotypes);
const model::PopulationModel model {*prior_model, {parameters_.max_joint_genotypes}, debug_log_};
if (parameters_.ploidies.size() == 1) {
std::vector<GenotypeIndex> genotype_indices;
auto genotypes = generate_all_genotypes(haplotypes, parameters_.ploidies.front(), genotype_indices);
if (debug_log_) stream(*debug_log_) << "There are " << genotypes.size() << " candidate genotypes";
auto inferences = model.evaluate(samples_, genotypes, genotype_indices, haplotypes, haplotype_likelihoods);
return std::make_unique<Latents>(samples_, haplotypes, std::move(genotypes), std::move(inferences));
} else {
auto unique_genotypes = generate_unique_genotypes(haplotypes, parameters_.ploidies);
auto sample_genotypes = assign_samples_to_genotypes(parameters_.ploidies, unique_genotypes);
auto inferences = model.evaluate(samples_, sample_genotypes, haplotype_likelihoods);
return std::make_unique<Latents>(samples_, haplotypes, std::move(unique_genotypes), std::move(inferences));
}
}
std::unique_ptr<Caller::Latents>
PopulationCaller::infer_latents_with_independence_model(const std::vector<Haplotype>& haplotypes,
const HaplotypeLikelihoodArray& haplotype_likelihoods) const
{
const auto prior_model = make_independent_prior_model(haplotypes);
const model::IndependentPopulationModel model {*prior_model, debug_log_};
if (parameters_.ploidies.size() == 1) {
auto genotypes = generate_all_genotypes(haplotypes, parameters_.ploidies.front());
if (debug_log_) stream(*debug_log_) << "There are " << genotypes.size() << " candidate genotypes";
auto inferences = model.evaluate(samples_, genotypes, haplotype_likelihoods);
return std::make_unique<Latents>(samples_, haplotypes, std::move(genotypes), std::move(inferences));
} else {
auto unique_genotypes = generate_unique_genotypes(haplotypes, parameters_.ploidies);
auto sample_genotypes = assign_samples_to_genotypes(parameters_.ploidies, unique_genotypes);
auto inferences = model.evaluate(samples_, sample_genotypes, haplotype_likelihoods);
return std::make_unique<Latents>(samples_, haplotypes, std::move(unique_genotypes), std::move(inferences));
}
}
std::unique_ptr<PopulationPriorModel> PopulationCaller::make_joint_prior_model(const std::vector<Haplotype>& haplotypes) const
{
if (parameters_.prior_model_params) {
return std::make_unique<CoalescentPopulationPriorModel>(CoalescentModel{
Haplotype {mapped_region(haplotypes.front()), reference_},
*parameters_.prior_model_params
});
} else {
return std::make_unique<UniformPopulationPriorModel>();
}
}
std::unique_ptr<GenotypePriorModel> PopulationCaller::make_independent_prior_model(const std::vector<Haplotype>& haplotypes) const
{
if (parameters_.prior_model_params) {
return std::make_unique<CoalescentGenotypePriorModel>(CoalescentModel {
Haplotype {mapped_region(haplotypes.front()), reference_},
*parameters_.prior_model_params, haplotypes.size(), CoalescentModel::CachingStrategy::address
});
} else {
return std::make_unique<UniformGenotypePriorModel>();
}
}
namespace debug {
namespace {
template <typename S>
void print_genotype_posteriors(S&& stream,
const GenotypeProbabilityMap& genotype_posteriors,
const std::size_t n)
{
const auto m = std::min(n, genotype_posteriors.size());
using GenotypeReference = std::reference_wrapper<const Genotype<Haplotype>>;
std::vector<std::pair<GenotypeReference, double>> v {};
v.reserve(genotype_posteriors.size());
std::copy(std::cbegin(genotype_posteriors), std::cend(genotype_posteriors),
std::back_inserter(v));
const auto mth = std::next(std::begin(v), m);
std::partial_sort(std::begin(v), mth, std::end(v),
[](const auto& lhs, const auto& rhs) {
return lhs.second > rhs.second;
});
std::for_each(std::begin(v), mth,
[&](const auto& p) {
print_variant_alleles(stream, p.first);
stream << " " << p.second << '\n';
});
}
template <typename S>
void print_genotype_posteriors(S&& stream,
const PopulationGenotypeProbabilityMap& genotype_posteriors,
const std::size_t n)
{
for (const auto& p : genotype_posteriors) {
stream << "Printing genotype posteriors for sample: " << p.first << '\n';
print_genotype_posteriors(stream, p.second, n);
}
}
void print_genotype_posteriors(const PopulationGenotypeProbabilityMap& genotype_posteriors,
const std::size_t n)
{
print_genotype_posteriors(std::cout, genotype_posteriors, n);
}
template <typename S>
void print_candidate_posteriors(S&& stream, const VariantPosteriorVector& candidate_posteriors,
const std::size_t n)
{
const auto m = std::min(n, candidate_posteriors.size());
if (m == candidate_posteriors.size()) {
stream << "Printing all candidate variant posteriors " << '\n';
} else {
stream << "Printing top " << m << " candidate variant posteriors " << '\n';
}
std::vector<std::pair<VariantReference, std::vector<Phred<double>>>> v {};
v.reserve(candidate_posteriors.size());
std::copy(std::cbegin(candidate_posteriors), std::cend(candidate_posteriors),
std::back_inserter(v));
const auto mth = std::next(std::begin(v), m);
std::partial_sort(std::begin(v), mth, std::end(v),
[] (const auto& lhs, const auto& rhs) {
return lhs.second > rhs.second;
});
std::for_each(std::begin(v), mth,
[&] (const auto& p) {
stream << p.first.get() << " ";
for (auto x : p.second) {
stream << x.probability_true() << ' ';
}
stream << '\n';
});
}
void print_candidate_posteriors(const VariantPosteriorVector& candidate_posteriors,
const std::size_t n)
{
print_candidate_posteriors(std::cout, candidate_posteriors, n);
}
} // namespace
void log(const PopulationGenotypeProbabilityMap& genotype_posteriors,
boost::optional<logging::DebugLogger>& debug_log,
boost::optional<logging::TraceLogger>& trace_log)
{
if (trace_log) {
print_genotype_posteriors(stream(*trace_log), genotype_posteriors, -1);
}
if (debug_log) {
print_genotype_posteriors(stream(*debug_log), genotype_posteriors, 5);
}
}
void log(const VariantPosteriorVector& candidate_posteriors,
boost::optional<logging::DebugLogger>& debug_log,
boost::optional<logging::TraceLogger>& trace_log)
{
if (trace_log) {
print_candidate_posteriors(stream(*trace_log), candidate_posteriors, -1);
}
if (debug_log) {
print_candidate_posteriors(stream(*debug_log), candidate_posteriors, 5);
}
}
} // namespace debug
} // namespace octopus
|
namespace factor
{
#define VM_C_API extern "C"
#define NULL_DLL NULL
void c_to_factor_toplevel(cell quot);
void init_signals();
void early_init();
const char *vm_executable_path();
const char *default_image_path();
template<typename Type> Type align_stack_pointer(Type sp)
{
return sp;
}
}
|
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2006 Warren Chou
Copyright (C) 2007 StatPro Italia srl
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy of the license along with this program; if not, please email
<quantlib-dev@lists.sf.net>. The license is also available online at
<http://quantlib.org/license.shtml>.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
/*! \file analyticcontinuousfloatinglookback.hpp
\brief Analytic engine for continuous floating-strike lookback
*/
#ifndef quantlib_analytic_continuous_floating_lookback_engine_hpp
#define quantlib_analytic_continuous_floating_lookback_engine_hpp
#include <ql/instruments/lookbackoption.hpp>
#include <ql/processes/blackscholesprocess.hpp>
#include <ql/math/distributions/normaldistribution.hpp>
namespace QuantLib {
//! Pricing engine for European continuous floating-strike lookback
/*! Formula from "Option Pricing Formulas",
E.G. Haug, McGraw-Hill, 1998, p.61-62
\ingroup lookbackengines
\test returned values verified against results from literature
*/
class AnalyticContinuousFloatingLookbackEngine
: public ContinuousFloatingLookbackOption::engine {
public:
AnalyticContinuousFloatingLookbackEngine(
ext::shared_ptr<GeneralizedBlackScholesProcess> process);
void calculate() const override;
private:
ext::shared_ptr<GeneralizedBlackScholesProcess> process_;
CumulativeNormalDistribution f_;
// helper methods
Real underlying() const;
Time residualTime() const;
Volatility volatility() const;
Real minmax() const;
Real stdDeviation() const;
Rate riskFreeRate() const;
DiscountFactor riskFreeDiscount() const;
Rate dividendYield() const;
DiscountFactor dividendDiscount() const;
Real A(Real eta) const;
};
}
#endif
|
/*
NMmrac2mu.cpp
Author: Benjamin A. Thomas
Copyright 2017 Institute of Nuclear Medicine, University College London.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This program generates a mu-map from Siemens mMR MRAC for PET reconstruction.
*/
#include <gdcmReader.h>
#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
#include <glog/logging.h>
#include <memory>
#include "nmtools/MRAC-mMR.hpp"
#include "EnvironmentInfo.h"
int main(int argc, char **argv)
{
const char* APP_NAME = "nm_mrac2mu";
std::string inputDirPath;
std::string outputFilePath = "";
std::string coordOrientation = "RAI";
//Set-up command line options
namespace po = boost::program_options;
namespace fs = boost::filesystem;
namespace nm = nmtools;
po::options_description desc("Options");
desc.add_options()
("help,h", "Print help information")
("version","Print version number")
//("verbose,v", "Be verbose")
("input,i", po::value<std::string>(&inputDirPath)->required(), "Input directory")
("output,o", po::value<std::string>(&outputFilePath)->required(), "Output file")
("orient", po::value<std::string>(&coordOrientation), "Output orientation: e.g. RAI or LPS (default = RAI)")
("head", "Output mu-map for mMR brain")
("log,l", "Write log file");
//Evaluate command line options
po::variables_map vm;
try {
po::store(po::parse_command_line(argc, argv, desc),
vm); // can throw
/** --help option
*/
if (vm.count("help")) {
std::cout << APP_NAME << std::endl
<< desc << std::endl;
return EXIT_SUCCESS;
}
if (vm.count("version") ) {
std::cout << APP_NAME << " : v" << VERSION_NO << std::endl;
return EXIT_SUCCESS;
}
po::notify(vm); // throws on error
} catch (po::error& e) {
std::cerr << "ERROR: " << e.what() << std::endl << std::endl;
std::cerr << desc << std::endl;
return EXIT_FAILURE;
}
//Configure logging
fs::path log_path = fs::complete(fs::current_path());
log_path /= APP_NAME;
log_path += "-";
//Pretty coloured logging (if supported)
FLAGS_colorlogtostderr = 1;
if (vm.count("log")){
FLAGS_alsologtostderr = 1;
}
else {
FLAGS_logtostderr = 1;
}
google::InitGoogleLogging(argv[0]);
google::SetLogDestination(google::INFO, log_path.string().c_str());
std::time_t startTime = std::time( 0 ) ;
//Application starts here
LOG(INFO) << "Started: " << std::asctime(std::localtime(&startTime));
LOG(INFO) << "Running '" << APP_NAME << "' version: " << VERSION_NO;
fs::path srcPath = inputDirPath;
//Check if input file even exists!
if (!fs::exists(srcPath)) {
LOG(ERROR) << "Input path " << srcPath << " does not exist!";
return EXIT_FAILURE;
}
//Check if the input is a file.
if (!fs::is_directory(srcPath)) {
LOG(ERROR) << srcPath.native() << " does not appear to be a directory!";
return EXIT_FAILURE;
}
std::unique_ptr<nm::MMRMRAC> mrac;
try {
mrac.reset(new nm::MMRMRAC(srcPath, coordOrientation));
} catch (bool){
LOG(ERROR) << "Failed to create MRAC converter!";
return EXIT_FAILURE;
}
if (vm.count("head")){
mrac->SetIsHead(true);
std::string str = coordOrientation;
std::transform(str.begin(), str.end(),str.begin(), ::toupper);
if (str != "RAS"){
LOG(WARNING) << "You may want to use RAS for --head.";
}
}
if (mrac->Update()){
LOG(INFO) << "Scaling complete";
} else {
LOG(ERROR) << "Failed to scale image";
return EXIT_FAILURE;
}
if (mrac->Write(outputFilePath)){
LOG(INFO) << "Writing complete";
} else {
LOG(ERROR) << "Failed to write output file!";
return EXIT_FAILURE;
}
//Print total execution time
std::time_t stopTime = std::time( 0 ) ;
unsigned int totalTime = stopTime - startTime;
LOG(INFO) << "Time taken: " << totalTime << " seconds";
LOG(INFO) << "Ended: " << std::asctime(std::localtime(&stopTime));
return EXIT_SUCCESS;
}
|
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_INTERPRETER_TEMPLATETABLE_HPP
#define SHARE_INTERPRETER_TEMPLATETABLE_HPP
#include "interpreter/bytecodes.hpp"
#include "memory/allocation.hpp"
#include "runtime/frame.hpp"
#include "utilities/macros.hpp"
#ifndef ZERO
// All the necessary definitions used for (bytecode) template generation. Instead of
// spreading the implementation functionality for each bytecode in the interpreter
// and the snippet generator, a template is assigned to each bytecode which can be
// used to generate the bytecode's implementation if needed.
class InterpreterMacroAssembler;
// A Template describes the properties of a code template for a given bytecode
// and provides a generator to generate the code template.
class Template {
private:
enum Flags {
uses_bcp_bit, // set if template needs the bcp pointing to bytecode
does_dispatch_bit, // set if template dispatches on its own
calls_vm_bit, // set if template calls the vm
wide_bit // set if template belongs to a wide instruction
};
typedef void (*generator)(int arg);
int _flags; // describes interpreter template properties (bcp unknown)
TosState _tos_in; // tos cache state before template execution
TosState _tos_out; // tos cache state after template execution
generator _gen; // template code generator
int _arg; // argument for template code generator
void initialize(int flags, TosState tos_in, TosState tos_out, generator gen, int arg);
friend class TemplateTable;
public:
Bytecodes::Code bytecode() const;
bool is_valid() const { return _gen != NULL; }
bool uses_bcp() const { return (_flags & (1 << uses_bcp_bit )) != 0; }
bool does_dispatch() const { return (_flags & (1 << does_dispatch_bit)) != 0; }
bool calls_vm() const { return (_flags & (1 << calls_vm_bit )) != 0; }
bool is_wide() const { return (_flags & (1 << wide_bit )) != 0; }
TosState tos_in() const { return _tos_in; }
TosState tos_out() const { return _tos_out; }
void generate(InterpreterMacroAssembler* masm);
};
// The TemplateTable defines all Templates and provides accessor functions
// to get the template for a given bytecode.
class TemplateTable: AllStatic {
public:
enum Operation { add, sub, mul, div, rem, _and, _or, _xor, shl, shr, ushr };
enum Condition { equal, not_equal, less, less_equal, greater, greater_equal };
enum CacheByte { f1_byte = 1, f2_byte = 2 }; // byte_no codes
enum RewriteControl { may_rewrite, may_not_rewrite }; // control for fast code under CDS
private:
static Template _template_table [Bytecodes::number_of_codes];
static Template _template_table_wide[Bytecodes::number_of_codes];
static Template* _desc; // the current template to be generated
static Bytecodes::Code bytecode() { return _desc->bytecode(); }
public:
//%note templates_1
static InterpreterMacroAssembler* _masm; // the assembler used when generating templates
private:
// special registers
static inline Address at_bcp(int offset);
// helpers
static void unimplemented_bc();
static void patch_bytecode(Bytecodes::Code bc, Register bc_reg,
Register temp_reg, bool load_bc_into_bc_reg = true, int byte_no = -1);
// C calls
static void call_VM(Register oop_result, address entry_point);
static void call_VM(Register oop_result, address entry_point, Register arg_1);
static void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2);
static void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2, Register arg_3);
// these overloadings are not presently used on SPARC:
static void call_VM(Register oop_result, Register last_java_sp, address entry_point);
static void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1);
static void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, Register arg_2);
static void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, Register arg_2, Register arg_3);
// bytecodes
static void nop();
static void aconst_null();
static void iconst(int value);
static void lconst(int value);
static void fconst(int value);
static void dconst(int value);
static void bipush();
static void sipush();
static void ldc(bool wide);
static void ldc2_w();
static void fast_aldc(bool wide);
static void locals_index(Register reg, int offset = 1);
static void iload();
static void fast_iload();
static void fast_iload2();
static void fast_icaload();
static void lload();
static void fload();
static void dload();
static void aload();
static void locals_index_wide(Register reg);
static void wide_iload();
static void wide_lload();
static void wide_fload();
static void wide_dload();
static void wide_aload();
static void iaload();
static void laload();
static void faload();
static void daload();
static void aaload();
static void baload();
static void caload();
static void saload();
static void iload(int n);
static void lload(int n);
static void fload(int n);
static void dload(int n);
static void aload(int n);
static void aload_0();
static void nofast_aload_0();
static void nofast_iload();
static void iload_internal(RewriteControl rc = may_rewrite);
static void aload_0_internal(RewriteControl rc = may_rewrite);
static void istore();
static void lstore();
static void fstore();
static void dstore();
static void astore();
static void wide_istore();
static void wide_lstore();
static void wide_fstore();
static void wide_dstore();
static void wide_astore();
static void iastore();
static void lastore();
static void fastore();
static void dastore();
static void aastore();
static void bastore();
static void castore();
static void sastore();
static void istore(int n);
static void lstore(int n);
static void fstore(int n);
static void dstore(int n);
static void astore(int n);
static void pop();
static void pop2();
static void dup();
static void dup_x1();
static void dup_x2();
static void dup2();
static void dup2_x1();
static void dup2_x2();
static void swap();
static void iop2(Operation op);
static void lop2(Operation op);
static void fop2(Operation op);
static void dop2(Operation op);
static void idiv();
static void irem();
static void lmul();
static void ldiv();
static void lrem();
static void lshl();
static void lshr();
static void lushr();
static void ineg();
static void lneg();
static void fneg();
static void dneg();
static void iinc();
static void wide_iinc();
static void convert();
static void lcmp();
static void float_cmp (bool is_float, int unordered_result);
static void float_cmp (int unordered_result);
static void double_cmp(int unordered_result);
static void branch(bool is_jsr, bool is_wide);
static void if_0cmp (Condition cc);
static void if_icmp (Condition cc);
static void if_nullcmp(Condition cc);
static void if_acmp (Condition cc);
static void _goto();
static void jsr();
static void ret();
static void wide_ret();
static void goto_w();
static void jsr_w();
static void tableswitch();
static void lookupswitch();
static void fast_linearswitch();
static void fast_binaryswitch();
static void _return(TosState state);
static void resolve_cache_and_index(int byte_no, // one of 1,2,11
Register cache, // output for CP cache
Register index, // output for CP index
size_t index_size); // one of 1,2,4
static void load_invoke_cp_cache_entry(int byte_no,
Register method,
Register itable_index,
Register flags,
bool is_invokevirtual,
bool is_virtual_final,
bool is_invokedynamic);
static void load_field_cp_cache_entry(Register obj,
Register cache,
Register index,
Register offset,
Register flags,
bool is_static);
static void invokevirtual(int byte_no);
static void invokespecial(int byte_no);
static void invokestatic(int byte_no);
static void invokeinterface(int byte_no);
static void invokedynamic(int byte_no);
static void invokehandle(int byte_no);
static void fast_invokevfinal(int byte_no);
static void getfield_or_static(int byte_no, bool is_static, RewriteControl rc = may_rewrite);
static void putfield_or_static(int byte_no, bool is_static, RewriteControl rc = may_rewrite);
static void getfield(int byte_no);
static void putfield(int byte_no);
static void nofast_getfield(int byte_no);
static void nofast_putfield(int byte_no);
static void getstatic(int byte_no);
static void putstatic(int byte_no);
static void pop_and_check_object(Register obj);
static void condy_helper(Label& Done); // shared by ldc instances
static void _new();
static void newarray();
static void anewarray();
static void arraylength();
static void checkcast();
static void instanceof();
static void athrow();
static void monitorenter();
static void monitorexit();
static void wide();
static void multianewarray();
static void fast_xaccess(TosState state);
static void fast_accessfield(TosState state);
static void fast_storefield(TosState state);
static void _breakpoint();
static void shouldnotreachhere();
// jvmti support
static void jvmti_post_field_access(Register cache, Register index, bool is_static, bool has_tos);
static void jvmti_post_field_mod(Register cache, Register index, bool is_static);
static void jvmti_post_fast_field_mod();
// debugging of TemplateGenerator
static void transition(TosState tos_in, TosState tos_out);// checks if in/out states expected by template generator correspond to table entries
// initialization helpers
static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)( ), char filler );
static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(int arg ), int arg );
static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(bool arg ), bool arg );
static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(TosState tos), TosState tos);
static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Operation op), Operation op);
static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Condition cc), Condition cc);
friend class Template;
// InterpreterMacroAssembler::is_a(), etc., need TemplateTable::call_VM().
friend class InterpreterMacroAssembler;
public:
// Initialization
static void initialize();
// Templates
static Template* template_for (Bytecodes::Code code) { Bytecodes::check (code); return &_template_table [code]; }
static Template* template_for_wide(Bytecodes::Code code) { Bytecodes::wide_check(code); return &_template_table_wide[code]; }
// Platform specifics
#include CPU_HEADER(templateTable)
};
#endif /* !ZERO */
#endif // SHARE_INTERPRETER_TEMPLATETABLE_HPP
|
#include "../avx512_vec.h"
int main()
{
avx512_int32vec_t input1;
avx512_int32vec_t input2;
std::cout << "Max 2 vector(int32_t)[" << avx512_int32vec_t::size() << "]\n";
read("input1", input1);
read("input2", input2);
auto avx1 = _mm512_load_si512(&input1);
auto avx2 = _mm512_load_si512(&input2);
auto avxr = _mm512_max_epi32(avx1, avx2);
avx512_int32vec_t result;
_mm512_store_si512(&result, avxr);
trace("result", result);
return 0;
}
|
#include "Rom.hh"
#include "DeviceConfig.hh"
#include "HardwareConfig.hh"
#include "XMLElement.hh"
#include "RomInfo.hh"
#include "RomDatabase.hh"
#include "FileContext.hh"
#include "Filename.hh"
#include "FileException.hh"
#include "PanasonicMemory.hh"
#include "MSXMotherBoard.hh"
#include "Reactor.hh"
#include "Debugger.hh"
#include "Debuggable.hh"
#include "CliComm.hh"
#include "FilePool.hh"
#include "ConfigException.hh"
#include "EmptyPatch.hh"
#include "IPSPatch.hh"
#include "StringOp.hh"
#include "ranges.hh"
#include "sha1.hh"
#include "stl.hh"
#include <cstring>
#include <limits>
#include <memory>
using std::string;
namespace openmsx {
class RomDebuggable final : public Debuggable
{
public:
RomDebuggable(Debugger& debugger, Rom& rom);
~RomDebuggable();
RomDebuggable(const RomDebuggable&) = delete;
RomDebuggable& operator=(const RomDebuggable&) = delete;
[[nodiscard]] unsigned getSize() const override;
[[nodiscard]] std::string_view getDescription() const override;
[[nodiscard]] byte read(unsigned address) override;
void write(unsigned address, byte value) override;
void moved(Rom& r);
private:
Debugger& debugger;
Rom* rom;
};
Rom::Rom(string name_, static_string_view description_,
const DeviceConfig& config, const string& id /*= {}*/)
: name(std::move(name_)), description(description_)
{
// Try all <rom> tags with matching "id" attribute.
string errors;
for (const auto* c : config.getXML()->getChildren("rom")) {
if (c->getAttributeValue("id", {}) == id) {
try {
init(config.getMotherBoard(), *c, config.getFileContext());
return;
} catch (MSXException& e) {
// remember error message, and try next
if (!errors.empty() && (errors.back() != '\n')) {
errors += '\n';
}
errors += e.getMessage();
}
}
}
if (errors.empty()) {
// No matching <rom> tag.
string err = "Missing <rom> tag";
if (!id.empty()) {
strAppend(err, " with id=\"", id, '"');
}
throw ConfigException(std::move(err));
} else {
// We got at least one matching <rom>, but it failed to load.
// Report error messages of all failed attempts.
throw ConfigException(errors);
}
}
void Rom::init(MSXMotherBoard& motherBoard, const XMLElement& config,
const FileContext& context)
{
// (Only) if the content of this ROM depends on state that is not part
// of a savestate, we want to compare the sha1sum of the ROM from the
// time the savestate was created with the one from the loaded
// savestate. External state can be a .rom file or a patch file.
bool checkResolvedSha1 = false;
auto sums = to_vector(config.getChildren("sha1"));
auto filenames = to_vector(config.getChildren("filename"));
const auto* resolvedFilenameElem = config.findChild("resolvedFilename");
const auto* resolvedSha1Elem = config.findChild("resolvedSha1");
if (config.findChild("firstblock")) {
// part of the TurboR main ROM
// If there is a firstblock/lastblock tag, (only) use these to
// locate the rom. In the past we would also write add a
// resolvedSha1 tag for this type of ROM (before we used
// 'checkResolvedSha1'). So there are old savestates that have
// both type of tags. For such a savestate it's important to
// first check firstblock, otherwise it will only load when
// there is a file that matches the sha1sums of the
// firstblock-lastblock portion of the containing file.
int first = config.getChildDataAsInt("firstblock", 0);
int last = config.getChildDataAsInt("lastblock", 0);
size = (last - first + 1) * 0x2000;
rom = motherBoard.getPanasonicMemory().getRomRange(first, last);
assert(rom);
// Part of a bigger (already checked) rom, no need to check.
checkResolvedSha1 = false;
} else if (resolvedFilenameElem || resolvedSha1Elem ||
!sums.empty() || !filenames.empty()) {
auto& filepool = motherBoard.getReactor().getFilePool();
// first try already resolved filename ..
if (resolvedFilenameElem) {
try {
file = File(std::string(resolvedFilenameElem->getData()));
} catch (FileException&) {
// ignore
}
}
// .. then try the actual sha1sum ..
auto fileType = context.isUserContext()
? FileType::ROM : FileType::SYSTEM_ROM;
if (!file.is_open() && resolvedSha1Elem) {
Sha1Sum sha1(resolvedSha1Elem->getData());
file = filepool.getFile(fileType, sha1);
if (file.is_open()) {
// avoid recalculating same sha1 later
originalSha1 = sha1;
}
}
// .. and then try filename as originally given by user ..
if (!file.is_open()) {
for (auto& f : filenames) {
try {
file = File(Filename(f->getData(), context));
break;
} catch (FileException&) {
// ignore
}
}
}
// .. then try all alternative sha1sums ..
// (this might retry the actual sha1sum)
if (!file.is_open()) {
for (auto& s : sums) {
Sha1Sum sha1(s->getData());
file = filepool.getFile(fileType, sha1);
if (file.is_open()) {
// avoid recalculating same sha1 later
originalSha1 = sha1;
break;
}
}
}
// .. still no file, then error
if (!file.is_open()) {
string error = strCat("Couldn't find ROM file for \"", name, '"');
if (!filenames.empty()) {
strAppend(error, ' ', filenames.front()->getData());
}
if (resolvedSha1Elem) {
strAppend(error, " (sha1: ", resolvedSha1Elem->getData(), ')');
} else if (!sums.empty()) {
strAppend(error, " (sha1: ", sums.front()->getData(), ')');
}
strAppend(error, '.');
throw MSXException(std::move(error));
}
// actually read file content
if (config.findChild("filesize") ||
config.findChild("skip_headerbytes")) {
throw MSXException(
"The <filesize> and <skip_headerbytes> tags "
"inside a <rom> section are no longer "
"supported.");
}
try {
auto mmap = file.mmap();
if (mmap.size() > std::numeric_limits<decltype(size)>::max()) {
throw MSXException("Rom file too big: ", file.getURL());
}
rom = mmap.data();
size = unsigned(mmap.size());
} catch (FileException&) {
throw MSXException("Error reading ROM image: ", file.getURL());
}
// For file-based roms, calc sha1 via File::getSha1Sum(). It can
// possibly use the FilePool cache to avoid the calculation.
if (originalSha1.empty()) {
originalSha1 = filepool.getSha1Sum(file);
}
// verify SHA1
if (!checkSHA1(config)) {
motherBoard.getMSXCliComm().printWarning(
"SHA1 sum for '", name,
"' does not match with sum of '",
file.getURL(), "'.");
}
// We loaded an external file, so check.
checkResolvedSha1 = true;
} else {
// for an empty SCC the <size> tag is missing, so take 0
// for MegaFlashRomSCC the <size> tag is used to specify
// the size of the mapper (and you don't care about initial
// content)
size = config.getChildDataAsInt("size", 0) * 1024; // in kb
extendedRom.resize(size);
memset(extendedRom.data(), 0xff, size);
rom = extendedRom.data();
// Content does not depend on external files. No need to check
checkResolvedSha1 = false;
}
if (size != 0) {
if (const auto* patchesElem = config.findChild("patches")) {
// calculate before content is altered
(void)getOriginalSHA1(); // fills cache
std::unique_ptr<PatchInterface> patch =
std::make_unique<EmptyPatch>(rom, size);
for (const auto* p : patchesElem->getChildren("ips")) {
patch = std::make_unique<IPSPatch>(
Filename(p->getData(), context),
std::move(patch));
}
auto patchSize = unsigned(patch->getSize());
if (patchSize <= size) {
patch->copyBlock(0, const_cast<byte*>(rom), size);
} else {
size = patchSize;
extendedRom.resize(size);
patch->copyBlock(0, extendedRom.data(), size);
rom = extendedRom.data();
}
// calculated because it's different from original
actualSha1 = SHA1::calc({rom, size});
// Content altered by external patch file -> check.
checkResolvedSha1 = true;
}
}
// TODO fix this, this is a hack that depends heavily on
// HardwareConfig::createRomConfig
if (StringOp::startsWith(name, "MSXRom")) {
auto& db = motherBoard.getReactor().getSoftwareDatabase();
std::string_view title;
if (const auto* romInfo = db.fetchRomInfo(getOriginalSHA1())) {
title = romInfo->getTitle(db.getBufferStart());
}
if (!title.empty()) {
name = title;
} else {
// unknown ROM, use file name
name = file.getOriginalName();
}
}
// Make name unique wrt all registered debuggables.
auto& debugger = motherBoard.getDebugger();
if (size) {
if (debugger.findDebuggable(name)) {
unsigned n = 0;
string tmp;
do {
tmp = strCat(name, " (", ++n, ')');
} while (debugger.findDebuggable(tmp));
name = std::move(tmp);
}
}
if (checkResolvedSha1) {
auto& doc = motherBoard.getMachineConfig()->getXMLDocument();
auto patchedSha1Str = getSHA1().toString();
const auto* actualSha1Elem = doc.getOrCreateChild(
const_cast<XMLElement&>(config),
"resolvedSha1", doc.allocateString(patchedSha1Str));
if (actualSha1Elem->getData() != patchedSha1Str) {
std::string_view tmp = file.is_open() ? file.getURL() : name;
// can only happen in case of loadstate
motherBoard.getMSXCliComm().printWarning(
"The content of the rom ", tmp, " has "
"changed since the time this savestate was "
"created. This might result in emulation "
"problems.");
}
}
// This must come after we store the 'resolvedSha1', because on
// loadstate we use that tag to search the complete rom in a filepool.
if (const auto* windowElem = config.findChild("window")) {
unsigned windowBase = windowElem->getAttributeValueAsInt("base", 0);
unsigned windowSize = windowElem->getAttributeValueAsInt("size", size);
if ((windowBase + windowSize) > size) {
throw MSXException(
"The specified window [", windowBase, ',',
windowBase + windowSize, ") falls outside "
"the rom (with size ", size, ").");
}
rom = &rom[windowBase];
size = windowSize;
}
// Only create the debuggable once all checks succeeded.
if (size) {
romDebuggable = std::make_unique<RomDebuggable>(debugger, *this);
}
}
bool Rom::checkSHA1(const XMLElement& config) const
{
auto sums = to_vector(config.getChildren("sha1"));
return sums.empty() ||
contains(sums, getOriginalSHA1(),
[](const auto* s) { return Sha1Sum(s->getData()); });
}
Rom::Rom(Rom&& r) noexcept
: rom (std::move(r.rom))
, extendedRom (std::move(r.extendedRom))
, file (std::move(r.file))
, originalSha1 (std::move(r.originalSha1))
, actualSha1 (std::move(r.actualSha1))
, name (std::move(r.name))
, description (std::move(r.description))
, size (std::move(r.size))
, romDebuggable(std::move(r.romDebuggable))
{
if (romDebuggable) romDebuggable->moved(*this);
}
Rom::~Rom() = default;
std::string_view Rom::getFilename() const
{
return file.is_open() ? file.getURL() : std::string_view();
}
const Sha1Sum& Rom::getOriginalSHA1() const
{
if (originalSha1.empty()) {
originalSha1 = SHA1::calc({rom, size});
}
return originalSha1;
}
const Sha1Sum& Rom::getSHA1() const
{
if (actualSha1.empty())
{
actualSha1 = getOriginalSHA1();
}
return actualSha1;
}
void Rom::addPadding(unsigned newSize, byte filler)
{
assert(newSize >= size);
if (newSize == size) return;
MemBuffer<byte> tmp(newSize);
auto* newData = tmp.data();
memcpy(newData, rom, size);
memset(newData + size, filler, newSize - size);
extendedRom = std::move(tmp);
rom = newData;
size = newSize;
}
RomDebuggable::RomDebuggable(Debugger& debugger_, Rom& rom_)
: debugger(debugger_), rom(&rom_)
{
debugger.registerDebuggable(rom->getName(), *this);
}
RomDebuggable::~RomDebuggable()
{
debugger.unregisterDebuggable(rom->getName(), *this);
}
unsigned RomDebuggable::getSize() const
{
return rom->getSize();
}
std::string_view RomDebuggable::getDescription() const
{
return rom->getDescription();
}
byte RomDebuggable::read(unsigned address)
{
assert(address < getSize());
return (*rom)[address];
}
void RomDebuggable::write(unsigned /*address*/, byte /*value*/)
{
// ignore
}
void RomDebuggable::moved(Rom& r)
{
rom = &r;
}
} // namespace openmsx
|
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2018 Dominik Charousset *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#pragma once
#include <array>
#include <chrono>
#include <functional>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
#include "caf/fwd.hpp"
#include "caf/timestamp.hpp"
#include "caf/detail/is_one_of.hpp"
#include "caf/detail/type_list.hpp"
#define CAF_HAS_MEMBER_TRAIT(name) \
template <class T> \
class has_##name##_member { \
private: \
template <class U> \
static auto sfinae(U* x) -> decltype(x->name(), std::true_type()); \
\
template <class U> \
static auto sfinae(...) -> std::false_type; \
\
using sfinae_type = decltype(sfinae<T>(nullptr)); \
\
public: \
static constexpr bool value = sfinae_type::value; \
}
#define CAF_HAS_ALIAS_TRAIT(name) \
template <class T> \
class has_##name##_alias { \
private: \
template <class C> \
static std::true_type sfinae(typename C::name*); \
\
template <class> \
static std::false_type sfinae(...); \
\
using sfinae_type = decltype(sfinae<T>(nullptr)); \
\
public: \
static constexpr bool value = sfinae_type::value; \
}
namespace caf::detail {
// -- backport of C++14 additions ----------------------------------------------
template <class T>
using decay_t = typename std::decay<T>::type;
template <bool B, class T, class F>
using conditional_t = typename std::conditional<B, T, F>::type;
template <bool V, class T = void>
using enable_if_t = typename std::enable_if<V, T>::type;
// -- custom traits ------------------------------------------------------------
template <class Trait, class T = void>
using enable_if_tt = typename std::enable_if<Trait::value, T>::type;
template <class T>
using remove_reference_t = typename std::remove_reference<T>::type;
/// Checks whether `T` defines a free function `to_string`.
template <class T>
class has_to_string {
private:
template <class U>
static auto sfinae(const U& x) -> decltype(to_string(x));
static void sfinae(...);
using result = decltype(sfinae(std::declval<const T&>()));
public:
static constexpr bool value = std::is_convertible<result, std::string>::value;
};
template <bool X>
using bool_token = std::integral_constant<bool, X>;
template <int X>
using int_token = std::integral_constant<int, X>;
/// Joins all bool constants using operator &&.
template <bool... BoolConstants>
struct conjunction;
template <>
struct conjunction<> {
static constexpr bool value = true;
};
template <bool X, bool... Xs>
struct conjunction<X, Xs...> {
static constexpr bool value = X && conjunction<Xs...>::value;
};
/// Joins all bool constants using operator ||.
template <bool... BoolConstants>
struct disjunction;
template <>
struct disjunction<> {
static constexpr bool value = false;
};
template <bool X, bool... Xs>
struct disjunction<X, Xs...> {
static constexpr bool value = X || disjunction<Xs...>::value;
};
/// Checks whether `T` is a `std::chrono::duration`.
template <class T>
struct is_duration : std::false_type {};
template <class Period, class Rep>
struct is_duration<std::chrono::duration<Period, Rep>> : std::true_type {};
/// Checks whether `T` is considered a builtin type.
///
/// Builtin types are: (1) all arithmetic types (including time types), (2)
/// string types from the STL, and (3) built-in types such as `actor_ptr`.
template <class T>
struct is_builtin {
static constexpr bool value = std::is_arithmetic<T>::value
|| is_duration<T>::value
|| is_one_of<T, timestamp, std::string,
std::u16string, std::u32string,
atom_value, message, actor, group,
node_id>::value;
};
/// Checks whether `T` is primitive, i.e., either an arithmetic type or
/// convertible to one of STL's string types.
template <class T>
struct is_primitive {
static constexpr bool value = std::is_arithmetic<T>::value
|| std::is_convertible<T, std::string>::value
|| std::is_convertible<T, std::u16string>::value
|| std::is_convertible<T, std::u32string>::value
|| std::is_convertible<T, atom_value>::value;
};
// Workaround for weird GCC 4.8 STL implementation that breaks
// `std::is_convertible<T, atom_value>::value` for tuples containing atom
// constants.
// TODO: remove when dropping support for GCC 4.8.
template <class... Ts>
struct is_primitive<std::tuple<Ts...>> : std::false_type {};
/// Checks whether `T1` is comparable with `T2`.
template <class T1, class T2>
class is_comparable {
// SFINAE: If you pass a "bool*" as third argument, then
// decltype(cmp_help_fun(...)) is bool if there's an
// operator==(A, B) because
// cmp_help_fun(A*, B*, bool*) is a better match than
// cmp_help_fun(A*, B*, void*). If there's no operator==(A, B)
// available, then cmp_help_fun(A*, B*, void*) is the only
// candidate and thus decltype(cmp_help_fun(...)) is void.
template <class A, class B>
static bool cmp_help_fun(const A* arg0, const B* arg1,
decltype(*arg0 == *arg1)*,
std::integral_constant<bool, false>);
// silences float-equal warnings caused by decltype(*arg0 == *arg1)
template <class A, class B>
static bool cmp_help_fun(const A*, const B*, bool*,
std::integral_constant<bool, true>);
template <class A, class B, class C>
static void cmp_help_fun(const A*, const B*, void*, C);
using result_type = decltype(cmp_help_fun(
static_cast<T1*>(nullptr), static_cast<T2*>(nullptr),
static_cast<bool*>(nullptr),
std::integral_constant<bool, std::is_arithmetic<T1>::value
&& std::is_arithmetic<T2>::value>{}));
public:
static constexpr bool value = std::is_same<bool, result_type>::value;
};
/// Checks whether `T` behaves like a forward iterator.
template <class T>
class is_forward_iterator {
template <class C>
static bool sfinae(C& x, C& y,
// check for operator*
decay_t<decltype(*x)>* = nullptr,
// check for operator++ returning an iterator
decay_t<decltype(x = ++y)>* = nullptr,
// check for operator==
decay_t<decltype(x == y)>* = nullptr,
// check for operator!=
decay_t<decltype(x != y)>* = nullptr);
static void sfinae(...);
using result_type = decltype(sfinae(std::declval<T&>(), std::declval<T&>()));
public:
static constexpr bool value = std::is_same<bool, result_type>::value;
};
/// Checks whether `T` has `begin()` and `end()` member
/// functions returning forward iterators.
template <class T>
class is_iterable {
// this horrible code would just disappear if we had concepts
template <class C>
static bool sfinae(C* cc,
// check if 'C::begin()' returns a forward iterator
enable_if_tt<is_forward_iterator<decltype(cc->begin())>>* = nullptr,
// check if begin() and end() both exist and are comparable
decltype(cc->begin() != cc->end())* = nullptr);
// SFNINAE default
static void sfinae(void*);
using result_type = decltype(sfinae(static_cast<decay_t<T>*>(nullptr)));
public:
static constexpr bool value = is_primitive<T>::value == false
&& std::is_same<bool, result_type>::value;
};
template <class T>
constexpr bool is_iterable<T>::value;
/// Checks whether `T` is a non-const reference.
template <class T>
struct is_mutable_ref : std::false_type { };
template <class T>
struct is_mutable_ref<const T&> : std::false_type { };
template <class T>
struct is_mutable_ref<T&> : std::true_type { };
/// Defines `result_type,` `arg_types,` and `fun_type`. Functor is
/// (a) a member function pointer, (b) a function,
/// (c) a function pointer, (d) an std::function.
///
/// `result_type` is the result type found in the signature.
/// `arg_types` are the argument types as {@link type_list}.
/// `fun_type` is an std::function with an equivalent signature.
template <class Functor>
struct callable_trait;
// good ol' function
template <class R, class... Ts>
struct callable_trait<R (Ts...)> {
using result_type = R;
using arg_types = type_list<Ts...>;
using fun_sig = R (Ts...);
using fun_type = std::function<R (Ts...)>;
static constexpr size_t num_args = sizeof...(Ts);
};
// member noexcept const function pointer
template <class C, typename R, class... Ts>
struct callable_trait<R (C::*)(Ts...) const noexcept>
: callable_trait<R(Ts...)> {};
// member noexcept function pointer
template <class C, typename R, class... Ts>
struct callable_trait<R (C::*)(Ts...) noexcept> : callable_trait<R(Ts...)> {};
// member const function pointer
template <class C, typename R, class... Ts>
struct callable_trait<R (C::*)(Ts...) const> : callable_trait<R (Ts...)> {};
// member function pointer
template <class C, typename R, class... Ts>
struct callable_trait<R (C::*)(Ts...)> : callable_trait<R (Ts...)> {};
// good ol' noexcept function pointer
template <class R, class... Ts>
struct callable_trait<R (*)(Ts...) noexcept> : callable_trait<R(Ts...)> {};
// good ol' function pointer
template <class R, class... Ts>
struct callable_trait<R (*)(Ts...)> : callable_trait<R (Ts...)> {};
template <class T>
struct has_apply_operator {
template <class U>
static auto sfinae(U*) -> decltype(&U::operator(), std::true_type());
template <class U>
static auto sfinae(...) -> std::false_type;
using type = decltype(sfinae<T>(nullptr));
static constexpr bool value = type::value;
};
// matches (IsFun || IsMemberFun)
template <class T,
bool IsFun = std::is_function<T>::value
|| std::is_function<
typename std::remove_pointer<T>::type
>::value
|| std::is_member_function_pointer<T>::value,
bool HasApplyOp = has_apply_operator<T>::value>
struct get_callable_trait_helper {
using type = callable_trait<T>;
using result_type = typename type::result_type;
using arg_types = typename type::arg_types;
using fun_type = typename type::fun_type;
using fun_sig = typename type::fun_sig;
static constexpr size_t num_args = tl_size<arg_types>::value;
};
// assume functor providing operator()
template <class T>
struct get_callable_trait_helper<T, false, true> {
using type = callable_trait<decltype(&T::operator())>;
using result_type = typename type::result_type;
using arg_types = typename type::arg_types;
using fun_type = typename type::fun_type;
using fun_sig = typename type::fun_sig;
static constexpr size_t num_args = tl_size<arg_types>::value;
};
template <class T>
struct get_callable_trait_helper<T, false, false> {};
/// Gets a callable trait for `T,` where `T` is a function object type,
/// i.e., a function, member function, or a class providing
/// the call operator.
template <class T>
struct get_callable_trait : get_callable_trait_helper<decay_t<T>> {};
template <class T>
using get_callable_trait_t = typename get_callable_trait<T>::type;
/// Checks whether `T` is a function or member function.
template <class T>
struct is_callable {
template <class C>
static bool _fun(C*, typename get_callable_trait<C>::type* = nullptr);
static void _fun(void*);
using result_type = decltype(_fun(static_cast<decay_t<T>*>(nullptr)));
public:
static constexpr bool value = std::is_same<bool, result_type>::value;
};
/// Checks whether `F` is callable with arguments of types `Ts...`.
template <class F, class... Ts>
struct is_callable_with {
template <class U>
static auto sfinae(U*)
-> decltype((std::declval<U&>())(std::declval<Ts>()...), std::true_type());
template <class U>
static auto sfinae(...) -> std::false_type;
using type = decltype(sfinae<F>(nullptr));
static constexpr bool value = type::value;
};
/// Checks whether `F` takes mutable references.
///
/// A manipulator is a functor that manipulates its arguments via
/// mutable references.
template <class F>
struct is_manipulator {
static constexpr bool value =
tl_exists<typename get_callable_trait<F>::arg_types, is_mutable_ref>::value;
};
/// Gets the Nth element of the template parameter pack `Ts`.
template <size_t N, class... Ts>
struct type_at;
template <size_t N, typename T0, class... Ts>
struct type_at<N, T0, Ts...> {
using type = typename type_at<N - 1, Ts...>::type;
};
template <class T0, class... Ts>
struct type_at<0, T0, Ts...> {
using type = T0;
};
// Checks whether T has a member variable named `name`.
template <class T, bool IsScalar = std::is_scalar<T>::value>
class has_name {
private:
// a simple struct with a member called `name`
struct fallback {
int name;
};
// creates an ambiguity for any `T` with the requested member
struct derived : T, fallback {
// no members
};
// picked for any U without requested member since `U::name` is not ambiguous
template <class U>
static char fun(U*, decltype(U::name)* = nullptr);
// picked for any U with requested member since `U::name` is ambiguous
static int fun(void*);
public:
static constexpr bool value = sizeof(fun(static_cast<derived*>(nullptr))) > 1;
};
template <class T>
class has_name<T, true> {
public:
static constexpr bool value = false;
};
template <class T>
class has_peek_all {
private:
template <class U>
static int fun(const U*,
decltype(std::declval<U&>().peek_all(unit))* = nullptr);
static char fun(const void*);
public:
static constexpr bool value = sizeof(fun(static_cast<T*>(nullptr))) > 1;
};
CAF_HAS_MEMBER_TRAIT(size);
CAF_HAS_MEMBER_TRAIT(data);
/// Checks whether F is convertible to either `std::function<void (T&)>`
/// or `std::function<void (const T&)>`.
template <class F, class T>
struct is_handler_for {
static constexpr bool value =
std::is_convertible<F, std::function<void (T&)>>::value
|| std::is_convertible<F, std::function<void (const T&)>>::value;
};
template <class T>
struct value_type_of {
using type = typename T::value_type;
};
template <class T>
struct value_type_of<T*> {
using type = T;
};
template <class T>
using value_type_of_t = typename value_type_of<T>::type;
template <class T>
using is_callable_t = typename std::enable_if<is_callable<T>::value>::type;
template <class F, class T>
using is_handler_for_ef =
typename std::enable_if<is_handler_for<F, T>::value>::type;
template <class T>
struct strip_reference_wrapper {
using type = T;
};
template <class T>
struct strip_reference_wrapper<std::reference_wrapper<T>> {
using type = T;
};
template <class T>
constexpr bool can_insert_elements_impl(
T*,
decltype(std::declval<T&>()
.insert(std::declval<T&>().end(),
std::declval<typename T::value_type>()))* = nullptr) {
return true;
}
template <class T>
constexpr bool can_insert_elements_impl(void*) {
return false;
}
template <class T>
constexpr bool can_insert_elements() {
return can_insert_elements_impl<T>(static_cast<T*>(nullptr));
}
/// Checks whether `Tpl` is a specialization of `T` or not.
template <template <class...> class Tpl, class T>
struct is_specialization : std::false_type { };
template <template <class...> class T, class... Ts>
struct is_specialization<T, T<Ts...>> : std::true_type { };
/// Transfers const from `T` to `U`. `U` remains unchanged if `T` is not const.
template <class T, class U>
struct transfer_const {
using type = U;
};
template <class T, class U>
struct transfer_const<const T, U> {
using type = const U;
};
template <class T, class U>
using transfer_const_t = typename transfer_const<T, U>::type;
template <class T>
struct is_stream : std::false_type {};
template <class T>
struct is_stream<stream<T>> : std::true_type {};
template <class T>
struct is_result : std::false_type {};
template <class T>
struct is_result<result<T>> : std::true_type {};
template <class T>
struct is_expected : std::false_type {};
template <class T>
struct is_expected<expected<T>> : std::true_type {};
// Checks whether `T` and `U` are integers of the same size and signedness.
// clang-format off
template <class T, class U,
bool Enable = std::is_integral<T>::value
&& std::is_integral<U>::value
&& !std::is_same<T, bool>::value
&& !std::is_same<U, bool>::value>
// clang-format on
struct is_equal_int_type {
static constexpr bool value = sizeof(T) == sizeof(U)
&& std::is_signed<T>::value
== std::is_signed<U>::value;
};
template <class T, typename U>
struct is_equal_int_type<T, U, false> : std::false_type { };
/// Compares `T` to `U` und evaluates to `true_type` if either
/// `T == U or if T and U are both integral types of the
/// same size and signedness. This works around the issue that
/// `uint8_t != unsigned char on some compilers.
template <class T, typename U>
struct is_same_ish
: std::conditional<
std::is_same<T, U>::value,
std::true_type,
is_equal_int_type<T, U>
>::type { };
/// Utility for fallbacks calling `static_assert`.
template <class>
struct always_false : std::false_type {};
/// Utility trait for removing const inside a `map<K, V>::value_type`.
template <class T>
struct deconst_kvp {
using type = T;
};
template <class K, class V>
struct deconst_kvp<std::pair<const K, V>> {
using type = std::pair<K, V>;
};
template <class T>
using deconst_kvp_t = typename deconst_kvp<T>::type;
/// Utility trait for checking whether T is a `std::pair`.
template <class T>
struct is_pair : std::false_type {};
template <class First, class Second>
struct is_pair<std::pair<First, Second>> : std::true_type {};
template <class T>
constexpr bool is_pair_v = is_pair<T>::value;
// -- traits to check for STL-style type aliases -------------------------------
CAF_HAS_ALIAS_TRAIT(value_type);
CAF_HAS_ALIAS_TRAIT(key_type);
CAF_HAS_ALIAS_TRAIT(mapped_type);
// -- constexpr functions for use in enable_if & friends -----------------------
template <class List1, class List2>
struct all_constructible : std::false_type {};
template <>
struct all_constructible<type_list<>, type_list<>> : std::true_type {};
template <class T, class... Ts, class U, class... Us>
struct all_constructible<type_list<T, Ts...>, type_list<U, Us...>> {
static constexpr bool value = std::is_constructible<T, U>::value
&& all_constructible<type_list<Ts...>,
type_list<Us...>>::value;
};
/// Checks whether T behaves like `std::map`.
template <class T>
struct is_map_like {
static constexpr bool value = is_iterable<T>::value
&& has_key_type_alias<T>::value
&& has_mapped_type_alias<T>::value;
};
template <class T>
constexpr bool is_map_like_v = is_map_like<T>::value;
/// Checks whether T behaves like `std::vector`, `std::list`, or `std::set`.
template <class T>
struct is_list_like {
static constexpr bool value = is_iterable<T>::value
&& has_value_type_alias<T>::value
&& !has_mapped_type_alias<T>::value;
};
template <class T>
constexpr bool is_list_like_v = is_list_like<T>::value;
template <class F, class... Ts>
struct is_invocable {
private:
template <class U>
static auto sfinae(U* f)
-> decltype((*f)(std::declval<Ts>()...), std::true_type());
template <class U>
static auto sfinae(...) -> std::false_type;
using sfinae_type = decltype(sfinae<F>(nullptr));
public:
static constexpr bool value = sfinae_type::value;
};
template <class R, class F, class... Ts>
struct is_invocable_r {
private:
template <class U>
static auto sfinae(U* f)
-> std::is_same<R, decltype((*f)(std::declval<Ts>()...))>;
template <class U>
static auto sfinae(...) -> std::false_type;
using sfinae_type = decltype(sfinae<F>(nullptr));
public:
static constexpr bool value = sfinae_type::value;
};
template <class T, class To>
class has_convertible_data_member {
private:
template <class U>
static auto sfinae(U* x) -> std::integral_constant<
bool, std::is_convertible<decltype(x->data()), To*>::value>;
template <class U>
static auto sfinae(...) -> std::false_type;
using sfinae_type = decltype(sfinae<T>(nullptr));
public:
static constexpr bool value = sfinae_type::value;
};
template <class T, class Arg>
struct can_apply {
template <class U>
static auto sfinae(U* x)
-> decltype(x->apply(std::declval<Arg>()), std::true_type{});
template <class U>
static auto sfinae(...) -> std::false_type;
using type = decltype(sfinae<T>(nullptr));
static constexpr bool value = type::value;
};
template <class T, class Arg>
constexpr bool can_apply_v = can_apply<T, Arg>::value;
/// Evaluates to `true` for all types that specialize `std::tuple_size`, i.e.,
/// `std::tuple`, `std::pair`, and `std::array`.
template <class T>
struct is_stl_tuple_type {
template <class U>
static auto sfinae(U*)
-> decltype(std::integral_constant<bool, std::tuple_size<U>::value >= 0>{});
template <class U>
static auto sfinae(...) -> std::false_type;
using type = decltype(sfinae<T>(nullptr));
static constexpr bool value = type::value;
};
template <class T>
constexpr bool is_stl_tuple_type_v = is_stl_tuple_type<T>::value;
} // namespace caf::detail
#undef CAF_HAS_MEMBER_TRAIT
#undef CAF_HAS_ALIAS_TRAIT
|
/* NxS Tabpages - written by Saivert */
#include "StdAfx.h"
#include "nxstabpages.h"
CNxSTabPages::~CNxSTabPages()
{
Clear();
}
HWND CNxSTabPages::SetTabCtrl(HWND NewTabCtrl)
{
HWND tmp;
tmp = m_hwTab;
if (IsWindow(NewTabCtrl))
{
if (GetCount()>0)
TabCtrl_DeleteAllItems(m_hwTab);
m_hwTab = NewTabCtrl;
if (GetCount()>0)
TabCtrl_DeleteAllItems(m_hwTab);
TabCtrl_SetItemExtra(m_hwTab, NXSTABPAGES_TABITEMSIZE);
}
return tmp;
}
bool CNxSTabPages::DelPage(int index)
{
TABITEM item(this);
if (TabCtrl_GetItem(m_hwTab, index, &item))
{
if (item.GetDlgHandle())
{
NMHDR hdr;
hdr.code = PSN_RESET;
hdr.hwndFrom = (HWND)this;
hdr.idFrom = 0;
if (TRUE==SendMessage(item.GetDlgHandle(), WM_NOTIFY, 0, (LPARAM)&hdr))
return false;
DestroyWindow(item.GetDlgHandle());
}
TabCtrl_DeleteItem(m_hwTab, index);
return true;
}
return false;
}
bool CNxSTabPages::GetPage(int index, TABITEMINFO &tp)
{
return TabCtrl_GetItem(m_hwTab, index, &tp)>0;
}
CNxSTabPages::TABITEMINFO& CNxSTabPages::Pages(int index)
{
GetPage(index, m_tptemp);
return m_tptemp;
}
bool CNxSTabPages::SendApply()
{
bool res=true;
TABITEM item(this);
//First we check if the active page wants to loose activation
if (m_curwnd)
{
NMHDR hdr;
hdr.code = PSN_KILLACTIVE;
hdr.hwndFrom = (HWND)this;
hdr.idFrom = 0;
if (TRUE==SendMessage(m_curwnd, WM_NOTIFY, 0, (LPARAM)&hdr))
return false;
}
//If the active page said OK, we send a PSN_APPLY notification message to
//all the pages. Any one of the pages can return PSNRET_INVALID_NOCHANGEPAGE
//to make SendApply() return false. This is a clue to keep the host dialog open.
for (int i=0; i<GetCount(); i++)
{
if (TabCtrl_GetItem(m_hwTab, i, &item))
{
if (item.GetDlgHandle())
{
NMHDR hdr;
hdr.code = PSN_APPLY;
hdr.hwndFrom = (HWND)this;
hdr.idFrom = 0;
if (PSNRET_INVALID_NOCHANGEPAGE==
SendMessage(item.GetDlgHandle(), WM_NOTIFY, 0, (LPARAM)&hdr))
{
res=false;
}
}
}
}
return res;
}
bool CNxSTabPages::Clear(void)
{
int i;
while ((i = GetCount()) > 0)
{
if (!DelPage(i-1)) return false;
}
m_curwnd=NULL; //There's no longer an active dialog now...
return true;
}
bool CNxSTabPages::HandleNotifications(WPARAM wParam, LPARAM lParam)
{
int idTabCtl = (int) LOWORD(wParam);
LPNMHDR lpnmhdr = (LPNMHDR) lParam;
if (lpnmhdr->hwndFrom == m_hwTab)
{
if (lpnmhdr->code == TCN_SELCHANGING)
{
NMHDR hdr;
hdr.code = PSN_KILLACTIVE;
hdr.hwndFrom = (HWND)this;
hdr.idFrom = 0;
return SendMessage(m_curwnd, WM_NOTIFY, 0, (LPARAM)&hdr)>0;
}
if (lpnmhdr->code == TCN_SELCHANGE)
{
return SelectPage_Internal(GetSelPage());
}
}
if (lpnmhdr->code == TTN_NEEDTEXT)
{
LPTOOLTIPTEXT lpttt = (LPTOOLTIPTEXT) lParam;
TABITEM item(this);
//Make sure it's our tab control's tooltip calling in...
if (lpnmhdr->hwndFrom != TabCtrl_GetToolTips(m_hwTab)) return false;
TabCtrl_GetItem(m_hwTab, lpttt->hdr.idFrom, &item);
lpttt->hinst = IS_INTRESOURCE(item.GetTip())?m_hinst:NULL;
lpttt->lpszText = item.GetTip();
}
return false;
}
int CNxSTabPages::AddPage(char* lpszTitle, char* lpszDlgRes, DLGPROC lpfnDlgProc, char* lpszTip)
{
TABITEM i(this);
if (!lpszDlgRes) return 0;
i.SetDlgRes(lpszDlgRes);
i.SetTip(lpszTip);
i.SetDlgProc(lpfnDlgProc);
if (!lpszTitle)
{
int len;
char *t;
HWND hwTemp;
hwTemp = CreateDialog(m_hinst,(LPCTSTR)lpszDlgRes,
GetDesktopWindow(), lpfnDlgProc);
len = GetWindowTextLength(hwTemp)+1;
t = new char[len];
GetWindowText(hwTemp, t, len);
i.SetTitle(t);
DestroyWindow(hwTemp);
}
else
i.SetTitle(lpszTitle);
return TabCtrl_InsertItem(m_hwTab, GetCount(), &i);
}
bool CNxSTabPages::SelectPage(int index)
{
if (m_curwnd)
{
NMHDR hdr;
hdr.code = PSN_KILLACTIVE;
hdr.hwndFrom = (HWND)this;
hdr.idFrom = 0;
if (TRUE==SendMessage(m_curwnd, WM_NOTIFY, 0, (LPARAM)&hdr))
return false;
}
if (SelectPage_Internal(index))
{
TabCtrl_SetCurSel(m_hwTab, index);
return true;
}
return false;
}
bool CNxSTabPages::SelectPage_Internal(int index)
{
HWND hwndDlg;
TABITEM item(this);
hwndDlg = GetParent(m_hwTab);
if (index >= 0)
{
if (m_curwnd) ShowWindow(m_curwnd, SW_HIDE);
if (!TabCtrl_GetItem(m_hwTab, index, &item)) return false;
if (NULL==item.GetDlgHandle())
{
item.SetDlgHandle(
CreateDialogParam(m_hinst, item.GetDlgRes(),
hwndDlg, item.GetDlgProc(), LPARAM(&item))
);
SetWindowLong(item.GetDlgHandle(), GWL_STYLE, WS_CHILD);
SetWindowLong(item.GetDlgHandle(), GWL_EXSTYLE, WS_EX_CONTROLPARENT);
SetParent(item.GetDlgHandle(), hwndDlg);
EnableThemeDlgTexture(item.GetDlgHandle(),
m_UseDlgTexture?ETDT_ENABLETAB:ETDT_DISABLE);
//Update item.dlghandle (application data item)
TabCtrl_SetItem(m_hwTab, index, &item);
}
{
NMHDR hdr;
hdr.code = PSN_SETACTIVE;
hdr.hwndFrom = (HWND)this;
hdr.idFrom = 0;
if (1==SendMessage(item.GetDlgHandle(), WM_NOTIFY, 0, (LPARAM)&hdr))
return false;
}
if (m_curwnd=item.GetDlgHandle())
{
RECT r;
GetWindowRect(m_hwTab,&r);
//Use client are if it says so...
if (!m_UseTabClientArea)
TabCtrl_AdjustRect(m_hwTab, FALSE, &r);
MapWindowPoints(HWND_DESKTOP, hwndDlg, LPPOINT(&r), 2);
//Make right & bottom be the width & height
r.right -= r.left;
r.bottom -= r.top;
SetWindowPos(item.GetDlgHandle(), 0, r.left, r.top, r.right, r.bottom,
SWP_NOACTIVATE|SWP_NOZORDER);
ShowWindow(item.GetDlgHandle(),SW_SHOWNA);
}
}
return true;
}
void CNxSTabPages::AdjustPageSize(void)
{
RECT r;
GetWindowRect(m_hwTab,&r);
//Use client are if it says so...
if (!m_UseTabClientArea)
TabCtrl_AdjustRect(m_hwTab, FALSE, &r);
MapWindowPoints(HWND_DESKTOP, GetParent(m_hwTab), LPPOINT(&r), 2);
//Make right & bottom be the width & height
r.right -= r.left;
r.bottom -= r.top;
SetWindowPos(m_curwnd, 0, r.left, r.top, r.right, r.bottom,
SWP_NOACTIVATE|SWP_NOZORDER);
}
bool CNxSTabPages::SetUseThemedDlgTexture(bool use)
{
bool prev=m_UseDlgTexture;
m_UseDlgTexture=use;
// If there are already some pages added,
// change the state for these pages' dialogs.
if (int count=GetCount())
{
for (int i=0;i<count;i++)
{
if (HWND hwndDlg=Pages(i).GetDlgHandle())
EnableThemeDlgTexture(hwndDlg, use?ETDT_ENABLETAB:ETDT_DISABLE);
}
}
return prev;
}
bool CNxSTabPages::SetUseTabClientArea(bool use)
{
bool prev=m_UseTabClientArea;
m_UseTabClientArea=use;
// Update currently selected page.
int i = GetSelPage();
if (i >= 0) AdjustPageSize();
return prev;
}
// A wrapper for the "EnableThemeDialogTexture" function located in
// UXTHEME.DLL. When you call this with the handle of a dialog, the
// dialog's background get a texture that matches the current theme.
// This only works on a Windows XP machine.
HRESULT CNxSTabPages::EnableThemeDlgTexture(HWND hwnd, DWORD flags)
{
typedef HRESULT (WINAPI * ENABLETHEMEDIALOGTEXTURE)(HWND, DWORD);
ENABLETHEMEDIALOGTEXTURE pfnETDT;
HINSTANCE hDll;
HRESULT res=-1;
if (NULL != (hDll = LoadLibrary(TEXT("uxtheme.dll"))))
{
if (NULL != (pfnETDT = (ENABLETHEMEDIALOGTEXTURE)GetProcAddress(hDll, "EnableThemeDialogTexture")))
{
res = pfnETDT(hwnd, flags);
}
FreeLibrary(hDll);
}
return res;
}
//#EOF
|
//--------------------------------------------------------------------------
// Code generated by the SmartSoft MDSD Toolchain
// The SmartSoft Toolchain has been developed by:
//
// Christian Schlegel (schlegel@hs-ulm.de)
// University of Applied Sciences Ulm
// Prittwitzstr. 10
// 89075 Ulm (Germany)
//
// Information about the SmartSoft MDSD Toolchain is available at:
// www.servicerobotik-ulm.de
//
// This file is generated once. Modify this file to your needs.
// If you want the toolchain to re-generate this file, please
// delete it before running the code generator.
//--------------------------------------------------------------------------
// --------------------------------------------------------------------------
//
// Copyright (C) 2011 Andreas Steck, Alex Lotz
//
// schlegel@hs-ulm.de
//
// ZAFH Servicerobotik Ulm
// University of Applied Sciences
// Prittwitzstr. 10
// D-89075 Ulm
// Germany
//
// This file is part of the "SmartSoft Communication Classes".
// It provides basic standardized data types for communication between
// different components in the mobile robotics context. These classes
// are designed to be used in conjunction with the SmartSoft Communication
// Library.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// --------------------------------------------------------------------------
#ifndef COMMBASICOBJECTS_COMMBATTERYEVENT_H_
#define COMMBASICOBJECTS_COMMBATTERYEVENT_H_
#include "CommBasicObjects/CommBatteryEventCore.hh"
namespace CommBasicObjects {
class CommBatteryEvent : public CommBatteryEventCore {
public:
// default constructors
CommBatteryEvent();
/**
* Constructor to set all values.
* NOTE that you have to keep this constructor consistent with the model!
* Use at your own choice.
*
* The preferred way to set values for initialization is:
* CommRepository::MyCommObject obj;
* obj.setX(1).setY(2).setZ(3)...;
*/
// CommBatteryEvent(const CommBasicObjects::ComparisonState &state, const double &chargeValue = 0.0);
CommBatteryEvent(const CommBatteryEventCore &commBatteryEvent);
CommBatteryEvent(const DATATYPE &commBatteryEvent);
virtual ~CommBatteryEvent();
// use framework specific getter and setter methods from core (base) class
using CommBatteryEventCore::get;
using CommBatteryEventCore::set;
//
// feel free to add customized methods here
//
inline void setVoltage(const double &value) { setChargeValue(value); }
inline double getVoltage() const { return getChargeValue(); }
inline void setBatteryState(ComparisonState state) { setState(state); }
inline ComparisonState getBatteryState() const { return getState(); }
};
inline std::ostream &operator<<(std::ostream &os, const CommBatteryEvent &co)
{
co.to_ostream(os);
return os;
}
} /* namespace CommBasicObjects */
#endif /* COMMBASICOBJECTS_COMMBATTERYEVENT_H_ */
|
// Observing move semantics
#include <class-a.h>
#include <iomanip>
#include <type_traits>
#include <cassert>
// Remember the approximate scale of value types:
//
// (i) means has identity
// (m) means is movable
//
// glvalue - i
// lvalue - i & !m
// xvalue - i & m
// prvalue - !i & m
// rvalue - m
//
// (note that !i & !m makes no sense, so we don't have such a value type)
int main( void )
{
std::string inst1{ "123zxc" };
// The 11th standard of c++ introduces a reference to rvalue type
// Which is used to implement move semantics.
// A reference to rvalue is witten as follows..
// Although we define `ref_rval` as a reference to rvalue, the compiler will avoid calling && variant of overloaded functions
// because this rvalue reference object has identifier.
// Normally you see such a definition in function arguments, not on local stack
std::string&& ref_rval = std::move( inst1 ); // the entry looks weird
const std::string&& ref_rval_const = std::move( inst1 ); // The code is valid, although doesn't make a sense
// because of constness preventing moving action
assert( not std::is_rvalue_reference< decltype( inst1 ) >::value );
assert( std::is_rvalue_reference< decltype( ref_rval ) >::value );
std::string inst2{ inst1 }; // calls string( const string& )
std::string inst3{ ref_rval }; // still calls string( const string& )
// From the perspective of compiler `ref_rval` still lives after call,
// So it doesn't call && constructor
struct move_or_copy {
static void fn1( const std::string& ) {
std::cout << "lvalue ref" << std::endl;
}
static void fn1( std::string&& ) {
std::cout << "rvalue ref" << std::endl;
}
};
move_or_copy::fn1( inst1 );
move_or_copy::fn1( ref_rval ); // The same result. Doesn't call && variant.
// In this context the variable has name, so it's treated as an lvalue
// If we want to call the && variant, we need to cast a non-const lvalue
// to an unnamed rvalue reference (i.e. xvalue).
// In other words we need to tell the compiler that this is expiring rvalue.
// `std::move` helps to convert non-const lvalue to xvalue
move_or_copy::fn1( std::move( ref_rval ) ); // calls &&-variant
// We might have a prvalue object. It's already prepared to be moved
move_or_copy::fn1( std::string{ "temporary object" } ); // calls &&-variant
// Step aside. An isolated simple example
{
std::string s1{ "1" }, s2{ "2" };
std::string s3 = s1; // calls string( const string& )
std::string s4 = s1 + s2; // s1 + s2 results in creating a prvalue. We are not likely to observe a && construction here
// most likely the compiler will elide copy.
std::string s5{ std::move( s4 ) }; // std::move returns a reference to rvalue that isn't bound to a name
std::cout << "s4: " << s4 << std::endl;
std::cout << "s5: " << s5 << std::endl;
}
// TODO: how to pass an initialization value via function call: const ref, &&, pass by value? Pros, cons
return 0;
}
|
/*
* Copyright (c) 2017-2018 InterlockLedger Network
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "IRZeroPaddingTest.h"
#include <irecordcore/irciphpd.h>
#include <cstring>
using namespace irecordcore::crypto;
//==============================================================================
// class IRZeroPaddingTest
//------------------------------------------------------------------------------
IRZeroPaddingTest::IRZeroPaddingTest() {
}
//------------------------------------------------------------------------------
IRZeroPaddingTest::~IRZeroPaddingTest() {
}
//------------------------------------------------------------------------------
void IRZeroPaddingTest::SetUp() {
}
//------------------------------------------------------------------------------
void IRZeroPaddingTest::TearDown() {
}
//------------------------------------------------------------------------------
TEST_F(IRZeroPaddingTest, Constructor) {
IRZeroPadding * p;
p = new IRZeroPadding();
delete p;
}
//------------------------------------------------------------------------------
TEST_F(IRZeroPaddingTest, addPadding) {
IRZeroPadding p;
std::uint8_t src[33];
std::uint8_t dst[33];
std::uint8_t exp[33];
std::uint64_t srcSize;
std::uint64_t dstSize;
unsigned int paddingSize;
for (srcSize = 0; srcSize <= 16; srcSize++) {
std::memset(src, 1, sizeof(src));
std::memset(dst, 2, sizeof(dst));
paddingSize = 16 - (srcSize % 16);
dstSize = sizeof(dst);
ASSERT_TRUE(p.addPadding(16, src, srcSize, dst, dstSize));
ASSERT_EQ(srcSize + paddingSize, dstSize);
ASSERT_EQ(2, dst[dstSize]);
std::memset(exp, 1, srcSize);
std::memset(exp + srcSize, 0, paddingSize);
ASSERT_EQ(0, std::memcmp(exp, dst, dstSize));
}
}
//------------------------------------------------------------------------------
TEST_F(IRZeroPaddingTest, removePadding) {
IRZeroPadding p;
std::uint8_t src[32];
std::uint64_t srcSize;
std::memset(src, 0, sizeof(src));
srcSize = 0;
ASSERT_TRUE(p.removePadding(32, src, srcSize));
ASSERT_EQ(0, srcSize);
for (unsigned int paddingSize = 1; paddingSize <= 16; paddingSize++) {
std::memset(src, 0, sizeof(src));
std::memset(src, 1, 16 - paddingSize);
srcSize = 16;
ASSERT_TRUE(p.removePadding(16, src, srcSize));
ASSERT_EQ(16 - paddingSize, srcSize);
}
for (unsigned int paddingSize = 1; paddingSize <= 16; paddingSize++) {
std::memset(src, 0, sizeof(src));
std::memset(src + 16, 1, 16 - paddingSize);
srcSize = sizeof(src);
ASSERT_TRUE(p.removePadding(16, src, srcSize));
ASSERT_EQ(sizeof(src) - paddingSize, srcSize);
}
}
//------------------------------------------------------------------------------
|
#include "StdAfx.h"
//#include "general/all.h"
//#include "private/all.h"
// #include "XML_GEN/ParamChantierPhotogram.h"
// NO MORE
eTypeGpsMod Str2eTypeGpsMod(const std::string & aName)
{
if (aName=="esingle")
return esingle;
else if (aName=="edgps")
return edgps;
else if (aName=="ekinematic")
return ekinematic;
else if (aName=="estatic")
return estatic;
else if (aName=="emovingbase")
return emovingbase;
else if (aName=="efixed")
return efixed;
else if (aName=="eppp_kine")
return eppp_kine;
else if (aName=="eppp_static")
return eppp_static;
else if (aName=="eNbTypeGpsMod")
return eNbTypeGpsMod;
else
{
cout << aName << " is not a correct value for enum eTypeGpsMod\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGpsMod) 0;
}
void xml_init(eTypeGpsMod & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGpsMod(aTree->Contenu());
}
std::string eToString(const eTypeGpsMod & anObj)
{
if (anObj==esingle)
return "esingle";
if (anObj==edgps)
return "edgps";
if (anObj==ekinematic)
return "ekinematic";
if (anObj==estatic)
return "estatic";
if (anObj==emovingbase)
return "emovingbase";
if (anObj==efixed)
return "efixed";
if (anObj==eppp_kine)
return "eppp_kine";
if (anObj==eppp_static)
return "eppp_static";
if (anObj==eNbTypeGpsMod)
return "eNbTypeGpsMod";
std::cout << "Enum = eTypeGpsMod\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGpsMod & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGpsMod & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGpsMod & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGpsMod) aIVal;
}
std::string Mangling( eTypeGpsMod *) {return "E6ADC16F3BA2A8E3FE3F";};
eTypeGpsSolFormat Str2eTypeGpsSolFormat(const std::string & aName)
{
if (aName=="ellh")
return ellh;
else if (aName=="exyz")
return exyz;
else if (aName=="eenu")
return eenu;
else if (aName=="enmea")
return enmea;
else if (aName=="eNbTypeGpsSolFormat")
return eNbTypeGpsSolFormat;
else
{
cout << aName << " is not a correct value for enum eTypeGpsSolFormat\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGpsSolFormat) 0;
}
void xml_init(eTypeGpsSolFormat & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGpsSolFormat(aTree->Contenu());
}
std::string eToString(const eTypeGpsSolFormat & anObj)
{
if (anObj==ellh)
return "ellh";
if (anObj==exyz)
return "exyz";
if (anObj==eenu)
return "eenu";
if (anObj==enmea)
return "enmea";
if (anObj==eNbTypeGpsSolFormat)
return "eNbTypeGpsSolFormat";
std::cout << "Enum = eTypeGpsSolFormat\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGpsSolFormat & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGpsSolFormat & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGpsSolFormat & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGpsSolFormat) aIVal;
}
std::string Mangling( eTypeGpsSolFormat *) {return "F80A43E81D4F1A9EFE3F";};
eTypeGpsHeight Str2eTypeGpsHeight(const std::string & aName)
{
if (aName=="eellipsoidal")
return eellipsoidal;
else if (aName=="egeodetic")
return egeodetic;
else if (aName=="eNbTypeGpsHeight")
return eNbTypeGpsHeight;
else
{
cout << aName << " is not a correct value for enum eTypeGpsHeight\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGpsHeight) 0;
}
void xml_init(eTypeGpsHeight & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGpsHeight(aTree->Contenu());
}
std::string eToString(const eTypeGpsHeight & anObj)
{
if (anObj==eellipsoidal)
return "eellipsoidal";
if (anObj==egeodetic)
return "egeodetic";
if (anObj==eNbTypeGpsHeight)
return "eNbTypeGpsHeight";
std::cout << "Enum = eTypeGpsHeight\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGpsHeight & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGpsHeight & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGpsHeight & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGpsHeight) aIVal;
}
std::string Mangling( eTypeGpsHeight *) {return "45024AA457628EA2FE3F";};
eTypeGeoid Str2eTypeGeoid(const std::string & aName)
{
if (aName=="einternal")
return einternal;
else if (aName=="eegm96")
return eegm96;
else if (aName=="eegm08_2_5")
return eegm08_2_5;
else if (aName=="eegm08_1")
return eegm08_1;
else if (aName=="egsi2000")
return egsi2000;
else if (aName=="eNbTypeGeoid")
return eNbTypeGeoid;
else
{
cout << aName << " is not a correct value for enum eTypeGeoid\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGeoid) 0;
}
void xml_init(eTypeGeoid & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGeoid(aTree->Contenu());
}
std::string eToString(const eTypeGeoid & anObj)
{
if (anObj==einternal)
return "einternal";
if (anObj==eegm96)
return "eegm96";
if (anObj==eegm08_2_5)
return "eegm08_2_5";
if (anObj==eegm08_1)
return "eegm08_1";
if (anObj==egsi2000)
return "egsi2000";
if (anObj==eNbTypeGeoid)
return "eNbTypeGeoid";
std::cout << "Enum = eTypeGeoid\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGeoid & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGeoid & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGeoid & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGeoid) aIVal;
}
std::string Mangling( eTypeGeoid *) {return "231123D0485B9DA5FF3F";};
eTypeRtkOutStats Str2eTypeRtkOutStats(const std::string & aName)
{
if (aName=="enone")
return enone;
else if (aName=="estate")
return estate;
else if (aName=="eresidual")
return eresidual;
else if (aName=="eNbTypeRtkOutStats")
return eNbTypeRtkOutStats;
else
{
cout << aName << " is not a correct value for enum eTypeRtkOutStats\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeRtkOutStats) 0;
}
void xml_init(eTypeRtkOutStats & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeRtkOutStats(aTree->Contenu());
}
std::string eToString(const eTypeRtkOutStats & anObj)
{
if (anObj==enone)
return "enone";
if (anObj==estate)
return "estate";
if (anObj==eresidual)
return "eresidual";
if (anObj==eNbTypeRtkOutStats)
return "eNbTypeRtkOutStats";
std::cout << "Enum = eTypeRtkOutStats\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeRtkOutStats & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeRtkOutStats & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeRtkOutStats & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeRtkOutStats) aIVal;
}
std::string Mangling( eTypeRtkOutStats *) {return "00CACD72F78D32B5F9BF";};
eTypeGpsStaticSol Str2eTypeGpsStaticSol(const std::string & aName)
{
if (aName=="eall")
return eall;
else if (aName=="eone")
return eone;
else if (aName=="eNbTypeGpsSolStatic")
return eNbTypeGpsSolStatic;
else
{
cout << aName << " is not a correct value for enum eTypeGpsStaticSol\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGpsStaticSol) 0;
}
void xml_init(eTypeGpsStaticSol & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGpsStaticSol(aTree->Contenu());
}
std::string eToString(const eTypeGpsStaticSol & anObj)
{
if (anObj==eall)
return "eall";
if (anObj==eone)
return "eone";
if (anObj==eNbTypeGpsSolStatic)
return "eNbTypeGpsSolStatic";
std::cout << "Enum = eTypeGpsStaticSol\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGpsStaticSol & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGpsStaticSol & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGpsStaticSol & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGpsStaticSol) aIVal;
}
std::string Mangling( eTypeGpsStaticSol *) {return "C036117A5A72ADC1F93F";};
eTypeGpsTimeSys Str2eTypeGpsTimeSys(const std::string & aName)
{
if (aName=="egpst")
return egpst;
else if (aName=="eutc")
return eutc;
else if (aName=="ejst")
return ejst;
else if (aName=="eNbTypeGpsTimeSys")
return eNbTypeGpsTimeSys;
else
{
cout << aName << " is not a correct value for enum eTypeGpsTimeSys\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGpsTimeSys) 0;
}
void xml_init(eTypeGpsTimeSys & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGpsTimeSys(aTree->Contenu());
}
std::string eToString(const eTypeGpsTimeSys & anObj)
{
if (anObj==egpst)
return "egpst";
if (anObj==eutc)
return "eutc";
if (anObj==ejst)
return "ejst";
if (anObj==eNbTypeGpsTimeSys)
return "eNbTypeGpsTimeSys";
std::cout << "Enum = eTypeGpsTimeSys\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGpsTimeSys & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGpsTimeSys & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGpsTimeSys & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGpsTimeSys) aIVal;
}
std::string Mangling( eTypeGpsTimeSys *) {return "25AB906B75F7C1A8FBBF";};
eTypeGpsTimeFormat Str2eTypeGpsTimeFormat(const std::string & aName)
{
if (aName=="etow")
return etow;
else if (aName=="ehms")
return ehms;
else if (aName=="eNbTypeGpsTimeFormat")
return eNbTypeGpsTimeFormat;
else
{
cout << aName << " is not a correct value for enum eTypeGpsTimeFormat\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGpsTimeFormat) 0;
}
void xml_init(eTypeGpsTimeFormat & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGpsTimeFormat(aTree->Contenu());
}
std::string eToString(const eTypeGpsTimeFormat & anObj)
{
if (anObj==etow)
return "etow";
if (anObj==ehms)
return "ehms";
if (anObj==eNbTypeGpsTimeFormat)
return "eNbTypeGpsTimeFormat";
std::cout << "Enum = eTypeGpsTimeFormat\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGpsTimeFormat & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGpsTimeFormat & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGpsTimeFormat & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGpsTimeFormat) aIVal;
}
std::string Mangling( eTypeGpsTimeFormat *) {return "84E59BAB379F3580FC3F";};
eTypeGpsDegFormat Str2eTypeGpsDegFormat(const std::string & aName)
{
if (aName=="edeg")
return edeg;
else if (aName=="edms")
return edms;
else if (aName=="eNbTypeGpsDegFormat")
return eNbTypeGpsDegFormat;
else
{
cout << aName << " is not a correct value for enum eTypeGpsDegFormat\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGpsDegFormat) 0;
}
void xml_init(eTypeGpsDegFormat & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGpsDegFormat(aTree->Contenu());
}
std::string eToString(const eTypeGpsDegFormat & anObj)
{
if (anObj==edeg)
return "edeg";
if (anObj==edms)
return "edms";
if (anObj==eNbTypeGpsDegFormat)
return "eNbTypeGpsDegFormat";
std::cout << "Enum = eTypeGpsDegFormat\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGpsDegFormat & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGpsDegFormat & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGpsDegFormat & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGpsDegFormat) aIVal;
}
std::string Mangling( eTypeGpsDegFormat *) {return "C61D36CF7C3BDBFEFD3F";};
eTypeGpsFreq Str2eTypeGpsFreq(const std::string & aName)
{
if (aName=="el1")
return el1;
else if (aName=="el1_l2")
return el1_l2;
else if (aName=="el1_l2_l5")
return el1_l2_l5;
else if (aName=="el1_l2_l5_l6")
return el1_l2_l5_l6;
else if (aName=="el1_l2_l5_l6_l7")
return el1_l2_l5_l6_l7;
else if (aName=="eNbTypeGpsFreq")
return eNbTypeGpsFreq;
else
{
cout << aName << " is not a correct value for enum eTypeGpsFreq\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGpsFreq) 0;
}
void xml_init(eTypeGpsFreq & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGpsFreq(aTree->Contenu());
}
std::string eToString(const eTypeGpsFreq & anObj)
{
if (anObj==el1)
return "el1";
if (anObj==el1_l2)
return "el1_l2";
if (anObj==el1_l2_l5)
return "el1_l2_l5";
if (anObj==el1_l2_l5_l6)
return "el1_l2_l5_l6";
if (anObj==el1_l2_l5_l6_l7)
return "el1_l2_l5_l6_l7";
if (anObj==eNbTypeGpsFreq)
return "eNbTypeGpsFreq";
std::cout << "Enum = eTypeGpsFreq\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGpsFreq & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGpsFreq & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGpsFreq & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGpsFreq) aIVal;
}
std::string Mangling( eTypeGpsFreq *) {return "920EC590BA16E7BEFE3F";};
eTypeGpsSol Str2eTypeGpsSol(const std::string & aName)
{
if (aName=="eforward")
return eforward;
else if (aName=="ebackward")
return ebackward;
else if (aName=="ecombined")
return ecombined;
else if (aName=="eNbTypeGpsSol")
return eNbTypeGpsSol;
else
{
cout << aName << " is not a correct value for enum eTypeGpsSol\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGpsSol) 0;
}
void xml_init(eTypeGpsSol & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGpsSol(aTree->Contenu());
}
std::string eToString(const eTypeGpsSol & anObj)
{
if (anObj==eforward)
return "eforward";
if (anObj==ebackward)
return "ebackward";
if (anObj==ecombined)
return "ecombined";
if (anObj==eNbTypeGpsSol)
return "eNbTypeGpsSol";
std::cout << "Enum = eTypeGpsSol\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGpsSol & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGpsSol & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGpsSol & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGpsSol) aIVal;
}
std::string Mangling( eTypeGpsSol *) {return "4A850566E94328C8FD3F";};
eTypeGpsEphe Str2eTypeGpsEphe(const std::string & aName)
{
if (aName=="eNav")
return eNav;
else if (aName=="eprecise")
return eprecise;
else if (aName=="ebrdc_sbas")
return ebrdc_sbas;
else if (aName=="ebrdc_ssrapc")
return ebrdc_ssrapc;
else if (aName=="ebrdc_ssrcom")
return ebrdc_ssrcom;
else if (aName=="eNbTypeGpsEphe")
return eNbTypeGpsEphe;
else
{
cout << aName << " is not a correct value for enum eTypeGpsEphe\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGpsEphe) 0;
}
void xml_init(eTypeGpsEphe & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGpsEphe(aTree->Contenu());
}
std::string eToString(const eTypeGpsEphe & anObj)
{
if (anObj==eNav)
return "eNav";
if (anObj==eprecise)
return "eprecise";
if (anObj==ebrdc_sbas)
return "ebrdc_sbas";
if (anObj==ebrdc_ssrapc)
return "ebrdc_ssrapc";
if (anObj==ebrdc_ssrcom)
return "ebrdc_ssrcom";
if (anObj==eNbTypeGpsEphe)
return "eNbTypeGpsEphe";
std::cout << "Enum = eTypeGpsEphe\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGpsEphe & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGpsEphe & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGpsEphe & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGpsEphe) aIVal;
}
std::string Mangling( eTypeGpsEphe *) {return "DC224A9B584ACF95FD3F";};
eTypeGpsAmbRes Str2eTypeGpsAmbRes(const std::string & aName)
{
if (aName=="eNONE")
return eNONE;
else if (aName=="econtinuous")
return econtinuous;
else if (aName=="einstantaneous")
return einstantaneous;
else if (aName=="efix_and_hold")
return efix_and_hold;
else if (aName=="eNbTypeGpsAmbRes")
return eNbTypeGpsAmbRes;
else
{
cout << aName << " is not a correct value for enum eTypeGpsAmbRes\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGpsAmbRes) 0;
}
void xml_init(eTypeGpsAmbRes & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGpsAmbRes(aTree->Contenu());
}
std::string eToString(const eTypeGpsAmbRes & anObj)
{
if (anObj==eNONE)
return "eNONE";
if (anObj==econtinuous)
return "econtinuous";
if (anObj==einstantaneous)
return "einstantaneous";
if (anObj==efix_and_hold)
return "efix_and_hold";
if (anObj==eNbTypeGpsAmbRes)
return "eNbTypeGpsAmbRes";
std::cout << "Enum = eTypeGpsAmbRes\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGpsAmbRes & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGpsAmbRes & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGpsAmbRes & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGpsAmbRes) aIVal;
}
std::string Mangling( eTypeGpsAmbRes *) {return "9C7F2ADBA4886BF2FE3F";};
eTypeGloAmbRes Str2eTypeGloAmbRes(const std::string & aName)
{
if (aName=="eOFF")
return eOFF;
else if (aName=="eon")
return eon;
else if (aName=="eautocal")
return eautocal;
else if (aName=="eNbTypeGloAmbRes")
return eNbTypeGloAmbRes;
else
{
cout << aName << " is not a correct value for enum eTypeGloAmbRes\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGloAmbRes) 0;
}
void xml_init(eTypeGloAmbRes & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGloAmbRes(aTree->Contenu());
}
std::string eToString(const eTypeGloAmbRes & anObj)
{
if (anObj==eOFF)
return "eOFF";
if (anObj==eon)
return "eon";
if (anObj==eautocal)
return "eautocal";
if (anObj==eNbTypeGloAmbRes)
return "eNbTypeGloAmbRes";
std::cout << "Enum = eTypeGloAmbRes\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGloAmbRes & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGloAmbRes & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGloAmbRes & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGloAmbRes) aIVal;
}
std::string Mangling( eTypeGloAmbRes *) {return "243FA0DA57BD5C95FC3F";};
eTypeGpsIonoCorr Str2eTypeGpsIonoCorr(const std::string & aName)
{
if (aName=="eoff")
return eoff;
else if (aName=="ebrdc")
return ebrdc;
else if (aName=="esbas")
return esbas;
else if (aName=="edual_freq")
return edual_freq;
else if (aName=="eest_stec")
return eest_stec;
else if (aName=="eionex_tec")
return eionex_tec;
else if (aName=="eqzs_brdc")
return eqzs_brdc;
else if (aName=="eqzs_lex")
return eqzs_lex;
else if (aName=="evtec_sf")
return evtec_sf;
else if (aName=="evtec_ef")
return evtec_ef;
else if (aName=="egtec")
return egtec;
else if (aName=="eNbTypeGpsIonoCorr")
return eNbTypeGpsIonoCorr;
else
{
cout << aName << " is not a correct value for enum eTypeGpsIonoCorr\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGpsIonoCorr) 0;
}
void xml_init(eTypeGpsIonoCorr & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGpsIonoCorr(aTree->Contenu());
}
std::string eToString(const eTypeGpsIonoCorr & anObj)
{
if (anObj==eoff)
return "eoff";
if (anObj==ebrdc)
return "ebrdc";
if (anObj==esbas)
return "esbas";
if (anObj==edual_freq)
return "edual_freq";
if (anObj==eest_stec)
return "eest_stec";
if (anObj==eionex_tec)
return "eionex_tec";
if (anObj==eqzs_brdc)
return "eqzs_brdc";
if (anObj==eqzs_lex)
return "eqzs_lex";
if (anObj==evtec_sf)
return "evtec_sf";
if (anObj==evtec_ef)
return "evtec_ef";
if (anObj==egtec)
return "egtec";
if (anObj==eNbTypeGpsIonoCorr)
return "eNbTypeGpsIonoCorr";
std::cout << "Enum = eTypeGpsIonoCorr\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGpsIonoCorr & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGpsIonoCorr & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGpsIonoCorr & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGpsIonoCorr) aIVal;
}
std::string Mangling( eTypeGpsIonoCorr *) {return "9C919FC0E589968EFF3F";};
eTypeGpsTropoCorr Str2eTypeGpsTropoCorr(const std::string & aName)
{
if (aName=="enull")
return enull;
else if (aName=="esaas")
return esaas;
else if (aName=="eSBAS")
return eSBAS;
else if (aName=="eest_ztd")
return eest_ztd;
else if (aName=="eest_ztdgrad")
return eest_ztdgrad;
else if (aName=="eNbTypeGpsTropoCorr")
return eNbTypeGpsTropoCorr;
else
{
cout << aName << " is not a correct value for enum eTypeGpsTropoCorr\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGpsTropoCorr) 0;
}
void xml_init(eTypeGpsTropoCorr & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGpsTropoCorr(aTree->Contenu());
}
std::string eToString(const eTypeGpsTropoCorr & anObj)
{
if (anObj==enull)
return "enull";
if (anObj==esaas)
return "esaas";
if (anObj==eSBAS)
return "eSBAS";
if (anObj==eest_ztd)
return "eest_ztd";
if (anObj==eest_ztdgrad)
return "eest_ztdgrad";
if (anObj==eNbTypeGpsTropoCorr)
return "eNbTypeGpsTropoCorr";
std::cout << "Enum = eTypeGpsTropoCorr\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGpsTropoCorr & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGpsTropoCorr & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGpsTropoCorr & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGpsTropoCorr) aIVal;
}
std::string Mangling( eTypeGpsTropoCorr *) {return "F3029F8209CD0C88FF3F";};
eTypeGpsAntPos Str2eTypeGpsAntPos(const std::string & aName)
{
if (aName=="eLLH")
return eLLH;
else if (aName=="eXYZ")
return eXYZ;
else if (aName=="ecode")
return ecode;
else if (aName=="eposfile")
return eposfile;
else if (aName=="erinexhead")
return erinexhead;
else if (aName=="ertcm")
return ertcm;
else if (aName=="eNbGpsAntPos")
return eNbGpsAntPos;
else
{
cout << aName << " is not a correct value for enum eTypeGpsAntPos\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeGpsAntPos) 0;
}
void xml_init(eTypeGpsAntPos & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeGpsAntPos(aTree->Contenu());
}
std::string eToString(const eTypeGpsAntPos & anObj)
{
if (anObj==eLLH)
return "eLLH";
if (anObj==eXYZ)
return "eXYZ";
if (anObj==ecode)
return "ecode";
if (anObj==eposfile)
return "eposfile";
if (anObj==erinexhead)
return "erinexhead";
if (anObj==ertcm)
return "ertcm";
if (anObj==eNbGpsAntPos)
return "eNbGpsAntPos";
std::cout << "Enum = eTypeGpsAntPos\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeGpsAntPos & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeGpsAntPos & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeGpsAntPos & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeGpsAntPos) aIVal;
}
std::string Mangling( eTypeGpsAntPos *) {return "54FDD7EFD0F827A6FE3F";};
eNewTypeMalt Str2eNewTypeMalt(const std::string & aName)
{
if (aName=="eTMalt_Ortho")
return eTMalt_Ortho;
else if (aName=="eTMalt_UrbanMNE")
return eTMalt_UrbanMNE;
else if (aName=="eTMalt_GeomImage")
return eTMalt_GeomImage;
else if (aName=="eTMalt_NbVals")
return eTMalt_NbVals;
else
{
cout << aName << " is not a correct value for enum eNewTypeMalt\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eNewTypeMalt) 0;
}
void xml_init(eNewTypeMalt & aVal,cElXMLTree * aTree)
{
aVal= Str2eNewTypeMalt(aTree->Contenu());
}
std::string eToString(const eNewTypeMalt & anObj)
{
if (anObj==eTMalt_Ortho)
return "eTMalt_Ortho";
if (anObj==eTMalt_UrbanMNE)
return "eTMalt_UrbanMNE";
if (anObj==eTMalt_GeomImage)
return "eTMalt_GeomImage";
if (anObj==eTMalt_NbVals)
return "eTMalt_NbVals";
std::cout << "Enum = eNewTypeMalt\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eNewTypeMalt & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eNewTypeMalt & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eNewTypeMalt & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eNewTypeMalt) aIVal;
}
std::string Mangling( eNewTypeMalt *) {return "640FC5583697CDA3FE3F";};
eTypeTapas Str2eTypeTapas(const std::string & aName)
{
if (aName=="eTT_RadialBasic")
return eTT_RadialBasic;
else if (aName=="eTT_RadialExtended")
return eTT_RadialExtended;
else if (aName=="eTT_Fraser")
return eTT_Fraser;
else if (aName=="eTT_FishEyeEqui")
return eTT_FishEyeEqui;
else if (aName=="eTT_AutoCal")
return eTT_AutoCal;
else if (aName=="eTT_Figee")
return eTT_Figee;
else if (aName=="eTT_HemiEqui")
return eTT_HemiEqui;
else if (aName=="eTT_RadialStd")
return eTT_RadialStd;
else if (aName=="eTT_FraserBasic")
return eTT_FraserBasic;
else if (aName=="eTT_FishEyeBasic")
return eTT_FishEyeBasic;
else if (aName=="eTT_FE_EquiSolBasic")
return eTT_FE_EquiSolBasic;
else if (aName=="eTT_RadGen7x2")
return eTT_RadGen7x2;
else if (aName=="eTT_RadGen11x2")
return eTT_RadGen11x2;
else if (aName=="eTT_RadGen15x2")
return eTT_RadGen15x2;
else if (aName=="eTT_RadGen19x2")
return eTT_RadGen19x2;
else if (aName=="eTT_NbVals")
return eTT_NbVals;
else
{
cout << aName << " is not a correct value for enum eTypeTapas\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeTapas) 0;
}
void xml_init(eTypeTapas & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeTapas(aTree->Contenu());
}
std::string eToString(const eTypeTapas & anObj)
{
if (anObj==eTT_RadialBasic)
return "eTT_RadialBasic";
if (anObj==eTT_RadialExtended)
return "eTT_RadialExtended";
if (anObj==eTT_Fraser)
return "eTT_Fraser";
if (anObj==eTT_FishEyeEqui)
return "eTT_FishEyeEqui";
if (anObj==eTT_AutoCal)
return "eTT_AutoCal";
if (anObj==eTT_Figee)
return "eTT_Figee";
if (anObj==eTT_HemiEqui)
return "eTT_HemiEqui";
if (anObj==eTT_RadialStd)
return "eTT_RadialStd";
if (anObj==eTT_FraserBasic)
return "eTT_FraserBasic";
if (anObj==eTT_FishEyeBasic)
return "eTT_FishEyeBasic";
if (anObj==eTT_FE_EquiSolBasic)
return "eTT_FE_EquiSolBasic";
if (anObj==eTT_RadGen7x2)
return "eTT_RadGen7x2";
if (anObj==eTT_RadGen11x2)
return "eTT_RadGen11x2";
if (anObj==eTT_RadGen15x2)
return "eTT_RadGen15x2";
if (anObj==eTT_RadGen19x2)
return "eTT_RadGen19x2";
if (anObj==eTT_NbVals)
return "eTT_NbVals";
std::cout << "Enum = eTypeTapas\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeTapas & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeTapas & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeTapas & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeTapas) aIVal;
}
std::string Mangling( eTypeTapas *) {return "58CA7259C38FBDFBFDBF";};
eTypeOriVid Str2eTypeOriVid(const std::string & aName)
{
if (aName=="eBBA")
return eBBA;
else if (aName=="eSBBA")
return eSBBA;
else if (aName=="eSBBAFus")
return eSBBAFus;
else if (aName=="eUndefVal")
return eUndefVal;
else
{
cout << aName << " is not a correct value for enum eTypeOriVid\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeOriVid) 0;
}
void xml_init(eTypeOriVid & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeOriVid(aTree->Contenu());
}
std::string eToString(const eTypeOriVid & anObj)
{
if (anObj==eBBA)
return "eBBA";
if (anObj==eSBBA)
return "eSBBA";
if (anObj==eSBBAFus)
return "eSBBAFus";
if (anObj==eUndefVal)
return "eUndefVal";
std::cout << "Enum = eTypeOriVid\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeOriVid & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeOriVid & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeOriVid & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeOriVid) aIVal;
}
std::string Mangling( eTypeOriVid *) {return "B852E3923E4851F8FE3F";};
eTypeMMByP Str2eTypeMMByP(const std::string & aName)
{
if (aName=="eGround")
return eGround;
else if (aName=="eStatue")
return eStatue;
else if (aName=="eForest")
return eForest;
else if (aName=="eTestIGN")
return eTestIGN;
else if (aName=="eQuickMac")
return eQuickMac;
else if (aName=="eMicMac")
return eMicMac;
else if (aName=="eBigMac")
return eBigMac;
else if (aName=="eMTDTmp")
return eMTDTmp;
else if (aName=="eNbTypeMMByP")
return eNbTypeMMByP;
else
{
cout << aName << " is not a correct value for enum eTypeMMByP\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeMMByP) 0;
}
void xml_init(eTypeMMByP & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeMMByP(aTree->Contenu());
}
std::string eToString(const eTypeMMByP & anObj)
{
if (anObj==eGround)
return "eGround";
if (anObj==eStatue)
return "eStatue";
if (anObj==eForest)
return "eForest";
if (anObj==eTestIGN)
return "eTestIGN";
if (anObj==eQuickMac)
return "eQuickMac";
if (anObj==eMicMac)
return "eMicMac";
if (anObj==eBigMac)
return "eBigMac";
if (anObj==eMTDTmp)
return "eMTDTmp";
if (anObj==eNbTypeMMByP)
return "eNbTypeMMByP";
std::cout << "Enum = eTypeMMByP\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeMMByP & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeMMByP & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeMMByP & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeMMByP) aIVal;
}
std::string Mangling( eTypeMMByP *) {return "48B81066C9E75AEEFB3F";};
eTypeQuality Str2eTypeQuality(const std::string & aName)
{
if (aName=="eQual_High")
return eQual_High;
else if (aName=="eQual_Average")
return eQual_Average;
else if (aName=="eQual_Low")
return eQual_Low;
else if (aName=="eNbTypeQual")
return eNbTypeQual;
else
{
cout << aName << " is not a correct value for enum eTypeQuality\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeQuality) 0;
}
void xml_init(eTypeQuality & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeQuality(aTree->Contenu());
}
std::string eToString(const eTypeQuality & anObj)
{
if (anObj==eQual_High)
return "eQual_High";
if (anObj==eQual_Average)
return "eQual_Average";
if (anObj==eQual_Low)
return "eQual_Low";
if (anObj==eNbTypeQual)
return "eNbTypeQual";
std::cout << "Enum = eTypeQuality\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeQuality & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeQuality & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeQuality & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeQuality) aIVal;
}
std::string Mangling( eTypeQuality *) {return "7412760D4FF1D79CFD3F";};
eTypeMalt Str2eTypeMalt(const std::string & aName)
{
if (aName=="eOrtho")
return eOrtho;
else if (aName=="eUrbanMNE")
return eUrbanMNE;
else if (aName=="eGeomImage")
return eGeomImage;
else if (aName=="eNbTypesMNE")
return eNbTypesMNE;
else
{
cout << aName << " is not a correct value for enum eTypeMalt\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeMalt) 0;
}
void xml_init(eTypeMalt & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeMalt(aTree->Contenu());
}
std::string eToString(const eTypeMalt & anObj)
{
if (anObj==eOrtho)
return "eOrtho";
if (anObj==eUrbanMNE)
return "eUrbanMNE";
if (anObj==eGeomImage)
return "eGeomImage";
if (anObj==eNbTypesMNE)
return "eNbTypesMNE";
std::cout << "Enum = eTypeMalt\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeMalt & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeMalt & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeMalt & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeMalt) aIVal;
}
std::string Mangling( eTypeMalt *) {return "64137C5D34A6E6F5FD3F";};
eTypeFichierApp Str2eTypeFichierApp(const std::string & aName)
{
if (aName=="eAppEgels")
return eAppEgels;
else if (aName=="eAppGeoCub")
return eAppGeoCub;
else if (aName=="eAppInFile")
return eAppInFile;
else if (aName=="eAppXML")
return eAppXML;
else if (aName=="eNbTypeApp")
return eNbTypeApp;
else
{
cout << aName << " is not a correct value for enum eTypeFichierApp\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeFichierApp) 0;
}
void xml_init(eTypeFichierApp & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeFichierApp(aTree->Contenu());
}
std::string eToString(const eTypeFichierApp & anObj)
{
if (anObj==eAppEgels)
return "eAppEgels";
if (anObj==eAppGeoCub)
return "eAppGeoCub";
if (anObj==eAppInFile)
return "eAppInFile";
if (anObj==eAppXML)
return "eAppXML";
if (anObj==eNbTypeApp)
return "eNbTypeApp";
std::cout << "Enum = eTypeFichierApp\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeFichierApp & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeFichierApp & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeFichierApp & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeFichierApp) aIVal;
}
std::string Mangling( eTypeFichierApp *) {return "8C91EA7BEC3CC981FD3F";};
eTypeFichierOriTxt Str2eTypeFichierOriTxt(const std::string & aName)
{
if (aName=="eOriTxtAgiSoft")
return eOriTxtAgiSoft;
else if (aName=="eOriBluh")
return eOriBluh;
else if (aName=="eOriTxtInFile")
return eOriTxtInFile;
else if (aName=="eNbTypeOriTxt")
return eNbTypeOriTxt;
else
{
cout << aName << " is not a correct value for enum eTypeFichierOriTxt\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeFichierOriTxt) 0;
}
void xml_init(eTypeFichierOriTxt & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeFichierOriTxt(aTree->Contenu());
}
std::string eToString(const eTypeFichierOriTxt & anObj)
{
if (anObj==eOriTxtAgiSoft)
return "eOriTxtAgiSoft";
if (anObj==eOriBluh)
return "eOriBluh";
if (anObj==eOriTxtInFile)
return "eOriTxtInFile";
if (anObj==eNbTypeOriTxt)
return "eNbTypeOriTxt";
std::cout << "Enum = eTypeFichierOriTxt\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeFichierOriTxt & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeFichierOriTxt & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeFichierOriTxt & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeFichierOriTxt) aIVal;
}
std::string Mangling( eTypeFichierOriTxt *) {return "BEDC75ABDE7DB1BCFF3F";};
eImpaintMethod Str2eImpaintMethod(const std::string & aName)
{
if (aName=="eImpaintL2")
return eImpaintL2;
else if (aName=="eImpaintMNT")
return eImpaintMNT;
else
{
cout << aName << " is not a correct value for enum eImpaintMethod\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eImpaintMethod) 0;
}
void xml_init(eImpaintMethod & aVal,cElXMLTree * aTree)
{
aVal= Str2eImpaintMethod(aTree->Contenu());
}
std::string eToString(const eImpaintMethod & anObj)
{
if (anObj==eImpaintL2)
return "eImpaintL2";
if (anObj==eImpaintMNT)
return "eImpaintMNT";
std::cout << "Enum = eImpaintMethod\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eImpaintMethod & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eImpaintMethod & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eImpaintMethod & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eImpaintMethod) aIVal;
}
std::string Mangling( eImpaintMethod *) {return "79AA429BB659CB8CFF3F";};
eTypeNumerique Str2eTypeNumerique(const std::string & aName)
{
if (aName=="eTN_u_int1")
return eTN_u_int1;
else if (aName=="eTN_int1")
return eTN_int1;
else if (aName=="eTN_u_int2")
return eTN_u_int2;
else if (aName=="eTN_int2")
return eTN_int2;
else if (aName=="eTN_int4")
return eTN_int4;
else if (aName=="eTN_float")
return eTN_float;
else if (aName=="eTN_double")
return eTN_double;
else if (aName=="eTN_Bits1MSBF")
return eTN_Bits1MSBF;
else
{
cout << aName << " is not a correct value for enum eTypeNumerique\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeNumerique) 0;
}
void xml_init(eTypeNumerique & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeNumerique(aTree->Contenu());
}
std::string eToString(const eTypeNumerique & anObj)
{
if (anObj==eTN_u_int1)
return "eTN_u_int1";
if (anObj==eTN_int1)
return "eTN_int1";
if (anObj==eTN_u_int2)
return "eTN_u_int2";
if (anObj==eTN_int2)
return "eTN_int2";
if (anObj==eTN_int4)
return "eTN_int4";
if (anObj==eTN_float)
return "eTN_float";
if (anObj==eTN_double)
return "eTN_double";
if (anObj==eTN_Bits1MSBF)
return "eTN_Bits1MSBF";
std::cout << "Enum = eTypeNumerique\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeNumerique & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeNumerique & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeNumerique & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeNumerique) aIVal;
}
std::string Mangling( eTypeNumerique *) {return "CE79743DF94C5FA5FE3F";};
eComprTiff Str2eComprTiff(const std::string & aName)
{
if (aName=="eComprTiff_None")
return eComprTiff_None;
else if (aName=="eComprTiff_LZW")
return eComprTiff_LZW;
else if (aName=="eComprTiff_FAX4")
return eComprTiff_FAX4;
else if (aName=="eComprTiff_PackBits")
return eComprTiff_PackBits;
else
{
cout << aName << " is not a correct value for enum eComprTiff\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eComprTiff) 0;
}
void xml_init(eComprTiff & aVal,cElXMLTree * aTree)
{
aVal= Str2eComprTiff(aTree->Contenu());
}
std::string eToString(const eComprTiff & anObj)
{
if (anObj==eComprTiff_None)
return "eComprTiff_None";
if (anObj==eComprTiff_LZW)
return "eComprTiff_LZW";
if (anObj==eComprTiff_FAX4)
return "eComprTiff_FAX4";
if (anObj==eComprTiff_PackBits)
return "eComprTiff_PackBits";
std::cout << "Enum = eComprTiff\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eComprTiff & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eComprTiff & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eComprTiff & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eComprTiff) aIVal;
}
std::string Mangling( eComprTiff *) {return "06AAF027614A29F7FE3F";};
eTypePreCondRad Str2eTypePreCondRad(const std::string & aName)
{
if (aName=="ePCR_Atgt")
return ePCR_Atgt;
else if (aName=="ePCR_2SinAtgtS2")
return ePCR_2SinAtgtS2;
else if (aName=="ePCR_Stereographik")
return ePCR_Stereographik;
else
{
cout << aName << " is not a correct value for enum eTypePreCondRad\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypePreCondRad) 0;
}
void xml_init(eTypePreCondRad & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypePreCondRad(aTree->Contenu());
}
std::string eToString(const eTypePreCondRad & anObj)
{
if (anObj==ePCR_Atgt)
return "ePCR_Atgt";
if (anObj==ePCR_2SinAtgtS2)
return "ePCR_2SinAtgtS2";
if (anObj==ePCR_Stereographik)
return "ePCR_Stereographik";
std::cout << "Enum = eTypePreCondRad\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypePreCondRad & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypePreCondRad & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypePreCondRad & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypePreCondRad) aIVal;
}
std::string Mangling( eTypePreCondRad *) {return "F8E94F7337FE19D7FBBF";};
eTypeSake Str2eTypeSake(const std::string & aName)
{
if (aName=="eDEM")
return eDEM;
else if (aName=="eOrthoIm")
return eOrthoIm;
else if (aName=="eNbTypeVals")
return eNbTypeVals;
else
{
cout << aName << " is not a correct value for enum eTypeSake\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeSake) 0;
}
void xml_init(eTypeSake & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeSake(aTree->Contenu());
}
std::string eToString(const eTypeSake & anObj)
{
if (anObj==eDEM)
return "eDEM";
if (anObj==eOrthoIm)
return "eOrthoIm";
if (anObj==eNbTypeVals)
return "eNbTypeVals";
std::cout << "Enum = eTypeSake\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeSake & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeSake & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeSake & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeSake) aIVal;
}
std::string Mangling( eTypeSake *) {return "52FDB3EEB97972B2FE3F";};
eModeGeomMNT Str2eModeGeomMNT(const std::string & aName)
{
if (aName=="eGeomMNTCarto")
return eGeomMNTCarto;
else if (aName=="eGeomMNTEuclid")
return eGeomMNTEuclid;
else if (aName=="eGeomMNTFaisceauIm1PrCh_Px1D")
return eGeomMNTFaisceauIm1PrCh_Px1D;
else if (aName=="eGeomMNTFaisceauIm1PrCh_Px2D")
return eGeomMNTFaisceauIm1PrCh_Px2D;
else if (aName=="eGeomMNTFaisceauIm1ZTerrain_Px1D")
return eGeomMNTFaisceauIm1ZTerrain_Px1D;
else if (aName=="eGeomMNTFaisceauIm1ZTerrain_Px2D")
return eGeomMNTFaisceauIm1ZTerrain_Px2D;
else if (aName=="eGeomPxBiDim")
return eGeomPxBiDim;
else if (aName=="eNoGeomMNT")
return eNoGeomMNT;
else if (aName=="eGeomMNTFaisceauPrChSpherik")
return eGeomMNTFaisceauPrChSpherik;
else
{
cout << aName << " is not a correct value for enum eModeGeomMNT\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eModeGeomMNT) 0;
}
void xml_init(eModeGeomMNT & aVal,cElXMLTree * aTree)
{
aVal= Str2eModeGeomMNT(aTree->Contenu());
}
std::string eToString(const eModeGeomMNT & anObj)
{
if (anObj==eGeomMNTCarto)
return "eGeomMNTCarto";
if (anObj==eGeomMNTEuclid)
return "eGeomMNTEuclid";
if (anObj==eGeomMNTFaisceauIm1PrCh_Px1D)
return "eGeomMNTFaisceauIm1PrCh_Px1D";
if (anObj==eGeomMNTFaisceauIm1PrCh_Px2D)
return "eGeomMNTFaisceauIm1PrCh_Px2D";
if (anObj==eGeomMNTFaisceauIm1ZTerrain_Px1D)
return "eGeomMNTFaisceauIm1ZTerrain_Px1D";
if (anObj==eGeomMNTFaisceauIm1ZTerrain_Px2D)
return "eGeomMNTFaisceauIm1ZTerrain_Px2D";
if (anObj==eGeomPxBiDim)
return "eGeomPxBiDim";
if (anObj==eNoGeomMNT)
return "eNoGeomMNT";
if (anObj==eGeomMNTFaisceauPrChSpherik)
return "eGeomMNTFaisceauPrChSpherik";
std::cout << "Enum = eModeGeomMNT\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eModeGeomMNT & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eModeGeomMNT & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eModeGeomMNT & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eModeGeomMNT) aIVal;
}
std::string Mangling( eModeGeomMNT *) {return "7F86042F81218AFFFD3F";};
eModeBinSift Str2eModeBinSift(const std::string & aName)
{
if (aName=="eModeLeBrisPP")
return eModeLeBrisPP;
else if (aName=="eModeAutopano")
return eModeAutopano;
else
{
cout << aName << " is not a correct value for enum eModeBinSift\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eModeBinSift) 0;
}
void xml_init(eModeBinSift & aVal,cElXMLTree * aTree)
{
aVal= Str2eModeBinSift(aTree->Contenu());
}
std::string eToString(const eModeBinSift & anObj)
{
if (anObj==eModeLeBrisPP)
return "eModeLeBrisPP";
if (anObj==eModeAutopano)
return "eModeAutopano";
std::cout << "Enum = eModeBinSift\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eModeBinSift & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eModeBinSift & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eModeBinSift & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eModeBinSift) aIVal;
}
std::string Mangling( eModeBinSift *) {return "F4DC105633F35CDEFE3F";};
eModeSolveurEq Str2eModeSolveurEq(const std::string & aName)
{
if (aName=="eSysPlein")
return eSysPlein;
else if (aName=="eSysCreuxMap")
return eSysCreuxMap;
else if (aName=="eSysCreuxFixe")
return eSysCreuxFixe;
else if (aName=="eSysL1Barrodale")
return eSysL1Barrodale;
else if (aName=="eSysL2BlocSym")
return eSysL2BlocSym;
else
{
cout << aName << " is not a correct value for enum eModeSolveurEq\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eModeSolveurEq) 0;
}
void xml_init(eModeSolveurEq & aVal,cElXMLTree * aTree)
{
aVal= Str2eModeSolveurEq(aTree->Contenu());
}
std::string eToString(const eModeSolveurEq & anObj)
{
if (anObj==eSysPlein)
return "eSysPlein";
if (anObj==eSysCreuxMap)
return "eSysCreuxMap";
if (anObj==eSysCreuxFixe)
return "eSysCreuxFixe";
if (anObj==eSysL1Barrodale)
return "eSysL1Barrodale";
if (anObj==eSysL2BlocSym)
return "eSysL2BlocSym";
std::cout << "Enum = eModeSolveurEq\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eModeSolveurEq & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eModeSolveurEq & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eModeSolveurEq & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eModeSolveurEq) aIVal;
}
std::string Mangling( eModeSolveurEq *) {return "AEFB457AE0ADEFC1FE3F";};
eUniteAngulaire Str2eUniteAngulaire(const std::string & aName)
{
if (aName=="eUniteAngleDegre")
return eUniteAngleDegre;
else if (aName=="eUniteAngleGrade")
return eUniteAngleGrade;
else if (aName=="eUniteAngleRadian")
return eUniteAngleRadian;
else if (aName=="eUniteAngleUnknown")
return eUniteAngleUnknown;
else
{
cout << aName << " is not a correct value for enum eUniteAngulaire\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eUniteAngulaire) 0;
}
void xml_init(eUniteAngulaire & aVal,cElXMLTree * aTree)
{
aVal= Str2eUniteAngulaire(aTree->Contenu());
}
std::string eToString(const eUniteAngulaire & anObj)
{
if (anObj==eUniteAngleDegre)
return "eUniteAngleDegre";
if (anObj==eUniteAngleGrade)
return "eUniteAngleGrade";
if (anObj==eUniteAngleRadian)
return "eUniteAngleRadian";
if (anObj==eUniteAngleUnknown)
return "eUniteAngleUnknown";
std::cout << "Enum = eUniteAngulaire\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eUniteAngulaire & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eUniteAngulaire & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eUniteAngulaire & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eUniteAngulaire) aIVal;
}
std::string Mangling( eUniteAngulaire *) {return "25364EBD43C8E5C9FE3F";};
eDegreLiberteCPP Str2eDegreLiberteCPP(const std::string & aName)
{
if (aName=="eCPPFiges")
return eCPPFiges;
else if (aName=="eCPPLies")
return eCPPLies;
else if (aName=="eCPPLibres")
return eCPPLibres;
else
{
cout << aName << " is not a correct value for enum eDegreLiberteCPP\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eDegreLiberteCPP) 0;
}
void xml_init(eDegreLiberteCPP & aVal,cElXMLTree * aTree)
{
aVal= Str2eDegreLiberteCPP(aTree->Contenu());
}
std::string eToString(const eDegreLiberteCPP & anObj)
{
if (anObj==eCPPFiges)
return "eCPPFiges";
if (anObj==eCPPLies)
return "eCPPLies";
if (anObj==eCPPLibres)
return "eCPPLibres";
std::cout << "Enum = eDegreLiberteCPP\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eDegreLiberteCPP & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eDegreLiberteCPP & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eDegreLiberteCPP & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eDegreLiberteCPP) aIVal;
}
std::string Mangling( eDegreLiberteCPP *) {return "48C3B3CCC34EB0F5FB3F";};
eModelesCalibUnif Str2eModelesCalibUnif(const std::string & aName)
{
if (aName=="eModeleEbner")
return eModeleEbner;
else if (aName=="eModeleDCBrown")
return eModeleDCBrown;
else if (aName=="eModelePolyDeg2")
return eModelePolyDeg2;
else if (aName=="eModelePolyDeg3")
return eModelePolyDeg3;
else if (aName=="eModelePolyDeg4")
return eModelePolyDeg4;
else if (aName=="eModelePolyDeg5")
return eModelePolyDeg5;
else if (aName=="eModelePolyDeg6")
return eModelePolyDeg6;
else if (aName=="eModelePolyDeg7")
return eModelePolyDeg7;
else if (aName=="eModele_FishEye_10_5_5")
return eModele_FishEye_10_5_5;
else if (aName=="eModele_EquiSolid_FishEye_10_5_5")
return eModele_EquiSolid_FishEye_10_5_5;
else if (aName=="eModele_DRad_PPaEqPPs")
return eModele_DRad_PPaEqPPs;
else if (aName=="eModele_Fraser_PPaEqPPs")
return eModele_Fraser_PPaEqPPs;
else if (aName=="eModeleRadFour7x2")
return eModeleRadFour7x2;
else if (aName=="eModeleRadFour11x2")
return eModeleRadFour11x2;
else if (aName=="eModeleRadFour15x2")
return eModeleRadFour15x2;
else if (aName=="eModeleRadFour19x2")
return eModeleRadFour19x2;
else if (aName=="eModelePolyDeg0")
return eModelePolyDeg0;
else if (aName=="eModelePolyDeg1")
return eModelePolyDeg1;
else if (aName=="eModele_Stereographik_FishEye_10_5_5")
return eModele_Stereographik_FishEye_10_5_5;
else
{
cout << aName << " is not a correct value for enum eModelesCalibUnif\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eModelesCalibUnif) 0;
}
void xml_init(eModelesCalibUnif & aVal,cElXMLTree * aTree)
{
aVal= Str2eModelesCalibUnif(aTree->Contenu());
}
std::string eToString(const eModelesCalibUnif & anObj)
{
if (anObj==eModeleEbner)
return "eModeleEbner";
if (anObj==eModeleDCBrown)
return "eModeleDCBrown";
if (anObj==eModelePolyDeg2)
return "eModelePolyDeg2";
if (anObj==eModelePolyDeg3)
return "eModelePolyDeg3";
if (anObj==eModelePolyDeg4)
return "eModelePolyDeg4";
if (anObj==eModelePolyDeg5)
return "eModelePolyDeg5";
if (anObj==eModelePolyDeg6)
return "eModelePolyDeg6";
if (anObj==eModelePolyDeg7)
return "eModelePolyDeg7";
if (anObj==eModele_FishEye_10_5_5)
return "eModele_FishEye_10_5_5";
if (anObj==eModele_EquiSolid_FishEye_10_5_5)
return "eModele_EquiSolid_FishEye_10_5_5";
if (anObj==eModele_DRad_PPaEqPPs)
return "eModele_DRad_PPaEqPPs";
if (anObj==eModele_Fraser_PPaEqPPs)
return "eModele_Fraser_PPaEqPPs";
if (anObj==eModeleRadFour7x2)
return "eModeleRadFour7x2";
if (anObj==eModeleRadFour11x2)
return "eModeleRadFour11x2";
if (anObj==eModeleRadFour15x2)
return "eModeleRadFour15x2";
if (anObj==eModeleRadFour19x2)
return "eModeleRadFour19x2";
if (anObj==eModelePolyDeg0)
return "eModelePolyDeg0";
if (anObj==eModelePolyDeg1)
return "eModelePolyDeg1";
if (anObj==eModele_Stereographik_FishEye_10_5_5)
return "eModele_Stereographik_FishEye_10_5_5";
std::cout << "Enum = eModelesCalibUnif\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eModelesCalibUnif & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eModelesCalibUnif & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eModelesCalibUnif & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eModelesCalibUnif) aIVal;
}
std::string Mangling( eModelesCalibUnif *) {return "C0E377046EC977C6F8BF";};
eTypeProjectionCam Str2eTypeProjectionCam(const std::string & aName)
{
if (aName=="eProjStenope")
return eProjStenope;
else if (aName=="eProjOrthographique")
return eProjOrthographique;
else if (aName=="eProjGrid")
return eProjGrid;
else
{
cout << aName << " is not a correct value for enum eTypeProjectionCam\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeProjectionCam) 0;
}
void xml_init(eTypeProjectionCam & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeProjectionCam(aTree->Contenu());
}
std::string eToString(const eTypeProjectionCam & anObj)
{
if (anObj==eProjStenope)
return "eProjStenope";
if (anObj==eProjOrthographique)
return "eProjOrthographique";
if (anObj==eProjGrid)
return "eProjGrid";
std::cout << "Enum = eTypeProjectionCam\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeProjectionCam & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeProjectionCam & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeProjectionCam & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeProjectionCam) aIVal;
}
std::string Mangling( eTypeProjectionCam *) {return "D0797F2BB67678ADFD3F";};
eTypeCoord Str2eTypeCoord(const std::string & aName)
{
if (aName=="eTC_WGS84")
return eTC_WGS84;
else if (aName=="eTC_GeoCentr")
return eTC_GeoCentr;
else if (aName=="eTC_RTL")
return eTC_RTL;
else if (aName=="eTC_Polyn")
return eTC_Polyn;
else if (aName=="eTC_Unknown")
return eTC_Unknown;
else if (aName=="eTC_Lambert93")
return eTC_Lambert93;
else if (aName=="eTC_LambertCC")
return eTC_LambertCC;
else if (aName=="eTC_Proj4")
return eTC_Proj4;
else
{
cout << aName << " is not a correct value for enum eTypeCoord\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeCoord) 0;
}
void xml_init(eTypeCoord & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeCoord(aTree->Contenu());
}
std::string eToString(const eTypeCoord & anObj)
{
if (anObj==eTC_WGS84)
return "eTC_WGS84";
if (anObj==eTC_GeoCentr)
return "eTC_GeoCentr";
if (anObj==eTC_RTL)
return "eTC_RTL";
if (anObj==eTC_Polyn)
return "eTC_Polyn";
if (anObj==eTC_Unknown)
return "eTC_Unknown";
if (anObj==eTC_Lambert93)
return "eTC_Lambert93";
if (anObj==eTC_LambertCC)
return "eTC_LambertCC";
if (anObj==eTC_Proj4)
return "eTC_Proj4";
std::cout << "Enum = eTypeCoord\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeCoord & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeCoord & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeCoord & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeCoord) aIVal;
}
std::string Mangling( eTypeCoord *) {return "56B245E315A254CCFE3F";};
std::string & cMicMacConfiguration::DirInstall()
{
return mDirInstall;
}
const std::string & cMicMacConfiguration::DirInstall()const
{
return mDirInstall;
}
int & cMicMacConfiguration::NbProcess()
{
return mNbProcess;
}
const int & cMicMacConfiguration::NbProcess()const
{
return mNbProcess;
}
void BinaryUnDumpFromFile(cMicMacConfiguration & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.DirInstall(),aFp);
BinaryUnDumpFromFile(anObj.NbProcess(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cMicMacConfiguration & anObj)
{
BinaryDumpInFile(aFp,anObj.DirInstall());
BinaryDumpInFile(aFp,anObj.NbProcess());
}
cElXMLTree * ToXMLTree(const cMicMacConfiguration & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"MicMacConfiguration",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("DirInstall"),anObj.DirInstall())->ReTagThis("DirInstall"));
aRes->AddFils(::ToXMLTree(std::string("NbProcess"),anObj.NbProcess())->ReTagThis("NbProcess"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cMicMacConfiguration & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.DirInstall(),aTree->Get("DirInstall",1)); //tototo
xml_init(anObj.NbProcess(),aTree->Get("NbProcess",1)); //tototo
}
std::string Mangling( cMicMacConfiguration *) {return "5B71172C2157C797FE3F";};
eTypeCoord & cBasicSystemeCoord::TypeCoord()
{
return mTypeCoord;
}
const eTypeCoord & cBasicSystemeCoord::TypeCoord()const
{
return mTypeCoord;
}
std::vector< double > & cBasicSystemeCoord::AuxR()
{
return mAuxR;
}
const std::vector< double > & cBasicSystemeCoord::AuxR()const
{
return mAuxR;
}
std::vector< int > & cBasicSystemeCoord::AuxI()
{
return mAuxI;
}
const std::vector< int > & cBasicSystemeCoord::AuxI()const
{
return mAuxI;
}
std::vector< std::string > & cBasicSystemeCoord::AuxStr()
{
return mAuxStr;
}
const std::vector< std::string > & cBasicSystemeCoord::AuxStr()const
{
return mAuxStr;
}
cTplValGesInit< bool > & cBasicSystemeCoord::ByFile()
{
return mByFile;
}
const cTplValGesInit< bool > & cBasicSystemeCoord::ByFile()const
{
return mByFile;
}
std::vector< eUniteAngulaire > & cBasicSystemeCoord::AuxRUnite()
{
return mAuxRUnite;
}
const std::vector< eUniteAngulaire > & cBasicSystemeCoord::AuxRUnite()const
{
return mAuxRUnite;
}
void BinaryUnDumpFromFile(cBasicSystemeCoord & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.TypeCoord(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
double aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.AuxR().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
int aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.AuxI().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.AuxStr().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ByFile().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ByFile().ValForcedForUnUmp(),aFp);
}
else anObj.ByFile().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
eUniteAngulaire aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.AuxRUnite().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cBasicSystemeCoord & anObj)
{
BinaryDumpInFile(aFp,anObj.TypeCoord());
BinaryDumpInFile(aFp,(int)anObj.AuxR().size());
for( std::vector< double >::const_iterator iT=anObj.AuxR().begin();
iT!=anObj.AuxR().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.AuxI().size());
for( std::vector< int >::const_iterator iT=anObj.AuxI().begin();
iT!=anObj.AuxI().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.AuxStr().size());
for( std::vector< std::string >::const_iterator iT=anObj.AuxStr().begin();
iT!=anObj.AuxStr().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.ByFile().IsInit());
if (anObj.ByFile().IsInit()) BinaryDumpInFile(aFp,anObj.ByFile().Val());
BinaryDumpInFile(aFp,(int)anObj.AuxRUnite().size());
for( std::vector< eUniteAngulaire >::const_iterator iT=anObj.AuxRUnite().begin();
iT!=anObj.AuxRUnite().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cBasicSystemeCoord & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"BasicSystemeCoord",eXMLBranche);
aRes->AddFils(ToXMLTree(std::string("TypeCoord"),anObj.TypeCoord())->ReTagThis("TypeCoord"));
for
( std::vector< double >::const_iterator it=anObj.AuxR().begin();
it !=anObj.AuxR().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("AuxR"),(*it))->ReTagThis("AuxR"));
for
( std::vector< int >::const_iterator it=anObj.AuxI().begin();
it !=anObj.AuxI().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("AuxI"),(*it))->ReTagThis("AuxI"));
for
( std::vector< std::string >::const_iterator it=anObj.AuxStr().begin();
it !=anObj.AuxStr().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("AuxStr"),(*it))->ReTagThis("AuxStr"));
if (anObj.ByFile().IsInit())
aRes->AddFils(::ToXMLTree(std::string("ByFile"),anObj.ByFile().Val())->ReTagThis("ByFile"));
for
( std::vector< eUniteAngulaire >::const_iterator it=anObj.AuxRUnite().begin();
it !=anObj.AuxRUnite().end();
it++
)
aRes->AddFils(ToXMLTree(std::string("AuxRUnite"),(*it))->ReTagThis("AuxRUnite"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cBasicSystemeCoord & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.TypeCoord(),aTree->Get("TypeCoord",1)); //tototo
xml_init(anObj.AuxR(),aTree->GetAll("AuxR",false,1));
xml_init(anObj.AuxI(),aTree->GetAll("AuxI",false,1));
xml_init(anObj.AuxStr(),aTree->GetAll("AuxStr",false,1));
xml_init(anObj.ByFile(),aTree->Get("ByFile",1),bool(false)); //tototo
xml_init(anObj.AuxRUnite(),aTree->GetAll("AuxRUnite",false,1));
}
std::string Mangling( cBasicSystemeCoord *) {return "F9740B28E8AC37A8FE3F";};
cTplValGesInit< std::string > & cSystemeCoord::Comment()
{
return mComment;
}
const cTplValGesInit< std::string > & cSystemeCoord::Comment()const
{
return mComment;
}
std::vector< cBasicSystemeCoord > & cSystemeCoord::BSC()
{
return mBSC;
}
const std::vector< cBasicSystemeCoord > & cSystemeCoord::BSC()const
{
return mBSC;
}
void BinaryUnDumpFromFile(cSystemeCoord & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Comment().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Comment().ValForcedForUnUmp(),aFp);
}
else anObj.Comment().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cBasicSystemeCoord aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.BSC().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cSystemeCoord & anObj)
{
BinaryDumpInFile(aFp,anObj.Comment().IsInit());
if (anObj.Comment().IsInit()) BinaryDumpInFile(aFp,anObj.Comment().Val());
BinaryDumpInFile(aFp,(int)anObj.BSC().size());
for( std::vector< cBasicSystemeCoord >::const_iterator iT=anObj.BSC().begin();
iT!=anObj.BSC().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cSystemeCoord & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"SystemeCoord",eXMLBranche);
if (anObj.Comment().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Comment"),anObj.Comment().Val())->ReTagThis("Comment"));
for
( std::vector< cBasicSystemeCoord >::const_iterator it=anObj.BSC().begin();
it !=anObj.BSC().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("BSC"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cSystemeCoord & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Comment(),aTree->Get("Comment",1)); //tototo
xml_init(anObj.BSC(),aTree->GetAll("BSC",false,1));
}
std::string Mangling( cSystemeCoord *) {return "3203392FE4A68BA9FF3F";};
cSystemeCoord & cChangementCoordonnees::SystemeSource()
{
return mSystemeSource;
}
const cSystemeCoord & cChangementCoordonnees::SystemeSource()const
{
return mSystemeSource;
}
cSystemeCoord & cChangementCoordonnees::SystemeCible()
{
return mSystemeCible;
}
const cSystemeCoord & cChangementCoordonnees::SystemeCible()const
{
return mSystemeCible;
}
void BinaryUnDumpFromFile(cChangementCoordonnees & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.SystemeSource(),aFp);
BinaryUnDumpFromFile(anObj.SystemeCible(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cChangementCoordonnees & anObj)
{
BinaryDumpInFile(aFp,anObj.SystemeSource());
BinaryDumpInFile(aFp,anObj.SystemeCible());
}
cElXMLTree * ToXMLTree(const cChangementCoordonnees & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ChangementCoordonnees",eXMLBranche);
aRes->AddFils(ToXMLTree(anObj.SystemeSource())->ReTagThis("SystemeSource"));
aRes->AddFils(ToXMLTree(anObj.SystemeCible())->ReTagThis("SystemeCible"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cChangementCoordonnees & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.SystemeSource(),aTree->Get("SystemeSource",1)); //tototo
xml_init(anObj.SystemeCible(),aTree->Get("SystemeCible",1)); //tototo
}
std::string Mangling( cChangementCoordonnees *) {return "9FCAC63671DEEE87FDBF";};
std::string & cFileOriMnt::NameFileMnt()
{
return mNameFileMnt;
}
const std::string & cFileOriMnt::NameFileMnt()const
{
return mNameFileMnt;
}
cTplValGesInit< std::string > & cFileOriMnt::NameFileMasque()
{
return mNameFileMasque;
}
const cTplValGesInit< std::string > & cFileOriMnt::NameFileMasque()const
{
return mNameFileMasque;
}
Pt2di & cFileOriMnt::NombrePixels()
{
return mNombrePixels;
}
const Pt2di & cFileOriMnt::NombrePixels()const
{
return mNombrePixels;
}
Pt2dr & cFileOriMnt::OriginePlani()
{
return mOriginePlani;
}
const Pt2dr & cFileOriMnt::OriginePlani()const
{
return mOriginePlani;
}
Pt2dr & cFileOriMnt::ResolutionPlani()
{
return mResolutionPlani;
}
const Pt2dr & cFileOriMnt::ResolutionPlani()const
{
return mResolutionPlani;
}
double & cFileOriMnt::OrigineAlti()
{
return mOrigineAlti;
}
const double & cFileOriMnt::OrigineAlti()const
{
return mOrigineAlti;
}
double & cFileOriMnt::ResolutionAlti()
{
return mResolutionAlti;
}
const double & cFileOriMnt::ResolutionAlti()const
{
return mResolutionAlti;
}
cTplValGesInit< int > & cFileOriMnt::NumZoneLambert()
{
return mNumZoneLambert;
}
const cTplValGesInit< int > & cFileOriMnt::NumZoneLambert()const
{
return mNumZoneLambert;
}
eModeGeomMNT & cFileOriMnt::Geometrie()
{
return mGeometrie;
}
const eModeGeomMNT & cFileOriMnt::Geometrie()const
{
return mGeometrie;
}
cTplValGesInit< Pt2dr > & cFileOriMnt::OrigineTgtLoc()
{
return mOrigineTgtLoc;
}
const cTplValGesInit< Pt2dr > & cFileOriMnt::OrigineTgtLoc()const
{
return mOrigineTgtLoc;
}
cTplValGesInit< int > & cFileOriMnt::Rounding()
{
return mRounding;
}
const cTplValGesInit< int > & cFileOriMnt::Rounding()const
{
return mRounding;
}
void BinaryUnDumpFromFile(cFileOriMnt & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.NameFileMnt(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NameFileMasque().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NameFileMasque().ValForcedForUnUmp(),aFp);
}
else anObj.NameFileMasque().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.NombrePixels(),aFp);
BinaryUnDumpFromFile(anObj.OriginePlani(),aFp);
BinaryUnDumpFromFile(anObj.ResolutionPlani(),aFp);
BinaryUnDumpFromFile(anObj.OrigineAlti(),aFp);
BinaryUnDumpFromFile(anObj.ResolutionAlti(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NumZoneLambert().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NumZoneLambert().ValForcedForUnUmp(),aFp);
}
else anObj.NumZoneLambert().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.Geometrie(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.OrigineTgtLoc().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.OrigineTgtLoc().ValForcedForUnUmp(),aFp);
}
else anObj.OrigineTgtLoc().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Rounding().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Rounding().ValForcedForUnUmp(),aFp);
}
else anObj.Rounding().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cFileOriMnt & anObj)
{
BinaryDumpInFile(aFp,anObj.NameFileMnt());
BinaryDumpInFile(aFp,anObj.NameFileMasque().IsInit());
if (anObj.NameFileMasque().IsInit()) BinaryDumpInFile(aFp,anObj.NameFileMasque().Val());
BinaryDumpInFile(aFp,anObj.NombrePixels());
BinaryDumpInFile(aFp,anObj.OriginePlani());
BinaryDumpInFile(aFp,anObj.ResolutionPlani());
BinaryDumpInFile(aFp,anObj.OrigineAlti());
BinaryDumpInFile(aFp,anObj.ResolutionAlti());
BinaryDumpInFile(aFp,anObj.NumZoneLambert().IsInit());
if (anObj.NumZoneLambert().IsInit()) BinaryDumpInFile(aFp,anObj.NumZoneLambert().Val());
BinaryDumpInFile(aFp,anObj.Geometrie());
BinaryDumpInFile(aFp,anObj.OrigineTgtLoc().IsInit());
if (anObj.OrigineTgtLoc().IsInit()) BinaryDumpInFile(aFp,anObj.OrigineTgtLoc().Val());
BinaryDumpInFile(aFp,anObj.Rounding().IsInit());
if (anObj.Rounding().IsInit()) BinaryDumpInFile(aFp,anObj.Rounding().Val());
}
cElXMLTree * ToXMLTree(const cFileOriMnt & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"FileOriMnt",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("NameFileMnt"),anObj.NameFileMnt())->ReTagThis("NameFileMnt"));
if (anObj.NameFileMasque().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NameFileMasque"),anObj.NameFileMasque().Val())->ReTagThis("NameFileMasque"));
aRes->AddFils(::ToXMLTree(std::string("NombrePixels"),anObj.NombrePixels())->ReTagThis("NombrePixels"));
aRes->AddFils(::ToXMLTree(std::string("OriginePlani"),anObj.OriginePlani())->ReTagThis("OriginePlani"));
aRes->AddFils(::ToXMLTree(std::string("ResolutionPlani"),anObj.ResolutionPlani())->ReTagThis("ResolutionPlani"));
aRes->AddFils(::ToXMLTree(std::string("OrigineAlti"),anObj.OrigineAlti())->ReTagThis("OrigineAlti"));
aRes->AddFils(::ToXMLTree(std::string("ResolutionAlti"),anObj.ResolutionAlti())->ReTagThis("ResolutionAlti"));
if (anObj.NumZoneLambert().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NumZoneLambert"),anObj.NumZoneLambert().Val())->ReTagThis("NumZoneLambert"));
aRes->AddFils(ToXMLTree(std::string("Geometrie"),anObj.Geometrie())->ReTagThis("Geometrie"));
if (anObj.OrigineTgtLoc().IsInit())
aRes->AddFils(::ToXMLTree(std::string("OrigineTgtLoc"),anObj.OrigineTgtLoc().Val())->ReTagThis("OrigineTgtLoc"));
if (anObj.Rounding().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Rounding"),anObj.Rounding().Val())->ReTagThis("Rounding"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cFileOriMnt & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameFileMnt(),aTree->Get("NameFileMnt",1)); //tototo
xml_init(anObj.NameFileMasque(),aTree->Get("NameFileMasque",1)); //tototo
xml_init(anObj.NombrePixels(),aTree->Get("NombrePixels",1)); //tototo
xml_init(anObj.OriginePlani(),aTree->Get("OriginePlani",1)); //tototo
xml_init(anObj.ResolutionPlani(),aTree->Get("ResolutionPlani",1)); //tototo
xml_init(anObj.OrigineAlti(),aTree->Get("OrigineAlti",1)); //tototo
xml_init(anObj.ResolutionAlti(),aTree->Get("ResolutionAlti",1)); //tototo
xml_init(anObj.NumZoneLambert(),aTree->Get("NumZoneLambert",1)); //tototo
xml_init(anObj.Geometrie(),aTree->Get("Geometrie",1)); //tototo
xml_init(anObj.OrigineTgtLoc(),aTree->Get("OrigineTgtLoc",1)); //tototo
xml_init(anObj.Rounding(),aTree->Get("Rounding",1)); //tototo
}
std::string Mangling( cFileOriMnt *) {return "2E0F4D388417F3DEFD3F";};
Pt2dr & cRefPlani::Origine()
{
return mOrigine;
}
const Pt2dr & cRefPlani::Origine()const
{
return mOrigine;
}
Pt2dr & cRefPlani::Resolution()
{
return mResolution;
}
const Pt2dr & cRefPlani::Resolution()const
{
return mResolution;
}
void BinaryUnDumpFromFile(cRefPlani & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Origine(),aFp);
BinaryUnDumpFromFile(anObj.Resolution(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cRefPlani & anObj)
{
BinaryDumpInFile(aFp,anObj.Origine());
BinaryDumpInFile(aFp,anObj.Resolution());
}
cElXMLTree * ToXMLTree(const cRefPlani & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"RefPlani",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Origine"),anObj.Origine())->ReTagThis("Origine"));
aRes->AddFils(::ToXMLTree(std::string("Resolution"),anObj.Resolution())->ReTagThis("Resolution"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cRefPlani & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Origine(),aTree->Get("Origine",1)); //tototo
xml_init(anObj.Resolution(),aTree->Get("Resolution",1)); //tototo
}
std::string Mangling( cRefPlani *) {return "735262B2342A5982FDBF";};
double & cRefAlti::Origine()
{
return mOrigine;
}
const double & cRefAlti::Origine()const
{
return mOrigine;
}
double & cRefAlti::Resolution()
{
return mResolution;
}
const double & cRefAlti::Resolution()const
{
return mResolution;
}
void BinaryUnDumpFromFile(cRefAlti & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Origine(),aFp);
BinaryUnDumpFromFile(anObj.Resolution(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cRefAlti & anObj)
{
BinaryDumpInFile(aFp,anObj.Origine());
BinaryDumpInFile(aFp,anObj.Resolution());
}
cElXMLTree * ToXMLTree(const cRefAlti & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"RefAlti",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Origine"),anObj.Origine())->ReTagThis("Origine"));
aRes->AddFils(::ToXMLTree(std::string("Resolution"),anObj.Resolution())->ReTagThis("Resolution"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cRefAlti & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Origine(),aTree->Get("Origine",1)); //tototo
xml_init(anObj.Resolution(),aTree->Get("Resolution",1)); //tototo
}
std::string Mangling( cRefAlti *) {return "F4EB7A39B1B87F8DFC3F";};
cTplValGesInit< cRefAlti > & cGestionAltimetrie::RefAlti()
{
return mRefAlti;
}
const cTplValGesInit< cRefAlti > & cGestionAltimetrie::RefAlti()const
{
return mRefAlti;
}
cTplValGesInit< double > & cGestionAltimetrie::ZMoyen()
{
return mZMoyen;
}
const cTplValGesInit< double > & cGestionAltimetrie::ZMoyen()const
{
return mZMoyen;
}
void BinaryUnDumpFromFile(cGestionAltimetrie & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.RefAlti().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.RefAlti().ValForcedForUnUmp(),aFp);
}
else anObj.RefAlti().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ZMoyen().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ZMoyen().ValForcedForUnUmp(),aFp);
}
else anObj.ZMoyen().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cGestionAltimetrie & anObj)
{
BinaryDumpInFile(aFp,anObj.RefAlti().IsInit());
if (anObj.RefAlti().IsInit()) BinaryDumpInFile(aFp,anObj.RefAlti().Val());
BinaryDumpInFile(aFp,anObj.ZMoyen().IsInit());
if (anObj.ZMoyen().IsInit()) BinaryDumpInFile(aFp,anObj.ZMoyen().Val());
}
cElXMLTree * ToXMLTree(const cGestionAltimetrie & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"GestionAltimetrie",eXMLBranche);
if (anObj.RefAlti().IsInit())
aRes->AddFils(ToXMLTree(anObj.RefAlti().Val())->ReTagThis("RefAlti"));
if (anObj.ZMoyen().IsInit())
aRes->AddFils(::ToXMLTree(std::string("ZMoyen"),anObj.ZMoyen().Val())->ReTagThis("ZMoyen"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cGestionAltimetrie & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.RefAlti(),aTree->Get("RefAlti",1)); //tototo
xml_init(anObj.ZMoyen(),aTree->Get("ZMoyen",1)); //tototo
}
std::string Mangling( cGestionAltimetrie *) {return "6A99A4140E2242D1FE3F";};
cTplValGesInit< cSystemeCoord > & cXmlGeoRefFile::SysCo()
{
return mSysCo;
}
const cTplValGesInit< cSystemeCoord > & cXmlGeoRefFile::SysCo()const
{
return mSysCo;
}
cRefPlani & cXmlGeoRefFile::RefPlani()
{
return mRefPlani;
}
const cRefPlani & cXmlGeoRefFile::RefPlani()const
{
return mRefPlani;
}
cTplValGesInit< cRefAlti > & cXmlGeoRefFile::RefAlti()
{
return GestionAltimetrie().RefAlti();
}
const cTplValGesInit< cRefAlti > & cXmlGeoRefFile::RefAlti()const
{
return GestionAltimetrie().RefAlti();
}
cTplValGesInit< double > & cXmlGeoRefFile::ZMoyen()
{
return GestionAltimetrie().ZMoyen();
}
const cTplValGesInit< double > & cXmlGeoRefFile::ZMoyen()const
{
return GestionAltimetrie().ZMoyen();
}
cGestionAltimetrie & cXmlGeoRefFile::GestionAltimetrie()
{
return mGestionAltimetrie;
}
const cGestionAltimetrie & cXmlGeoRefFile::GestionAltimetrie()const
{
return mGestionAltimetrie;
}
void BinaryUnDumpFromFile(cXmlGeoRefFile & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.SysCo().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.SysCo().ValForcedForUnUmp(),aFp);
}
else anObj.SysCo().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.RefPlani(),aFp);
BinaryUnDumpFromFile(anObj.GestionAltimetrie(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlGeoRefFile & anObj)
{
BinaryDumpInFile(aFp,anObj.SysCo().IsInit());
if (anObj.SysCo().IsInit()) BinaryDumpInFile(aFp,anObj.SysCo().Val());
BinaryDumpInFile(aFp,anObj.RefPlani());
BinaryDumpInFile(aFp,anObj.GestionAltimetrie());
}
cElXMLTree * ToXMLTree(const cXmlGeoRefFile & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlGeoRefFile",eXMLBranche);
if (anObj.SysCo().IsInit())
aRes->AddFils(ToXMLTree(anObj.SysCo().Val())->ReTagThis("SysCo"));
aRes->AddFils(ToXMLTree(anObj.RefPlani())->ReTagThis("RefPlani"));
aRes->AddFils(ToXMLTree(anObj.GestionAltimetrie())->ReTagThis("GestionAltimetrie"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlGeoRefFile & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.SysCo(),aTree->Get("SysCo",1)); //tototo
xml_init(anObj.RefPlani(),aTree->Get("RefPlani",1)); //tototo
xml_init(anObj.GestionAltimetrie(),aTree->Get("GestionAltimetrie",1)); //tototo
}
std::string Mangling( cXmlGeoRefFile *) {return "0965D6D84049F1F8FE3F";};
std::string & cSpecExtractFromFile::NameFile()
{
return mNameFile;
}
const std::string & cSpecExtractFromFile::NameFile()const
{
return mNameFile;
}
std::string & cSpecExtractFromFile::NameTag()
{
return mNameTag;
}
const std::string & cSpecExtractFromFile::NameTag()const
{
return mNameTag;
}
cTplValGesInit< bool > & cSpecExtractFromFile::AutorizeNonExisting()
{
return mAutorizeNonExisting;
}
const cTplValGesInit< bool > & cSpecExtractFromFile::AutorizeNonExisting()const
{
return mAutorizeNonExisting;
}
void BinaryUnDumpFromFile(cSpecExtractFromFile & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.NameFile(),aFp);
BinaryUnDumpFromFile(anObj.NameTag(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.AutorizeNonExisting().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.AutorizeNonExisting().ValForcedForUnUmp(),aFp);
}
else anObj.AutorizeNonExisting().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cSpecExtractFromFile & anObj)
{
BinaryDumpInFile(aFp,anObj.NameFile());
BinaryDumpInFile(aFp,anObj.NameTag());
BinaryDumpInFile(aFp,anObj.AutorizeNonExisting().IsInit());
if (anObj.AutorizeNonExisting().IsInit()) BinaryDumpInFile(aFp,anObj.AutorizeNonExisting().Val());
}
cElXMLTree * ToXMLTree(const cSpecExtractFromFile & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"SpecExtractFromFile",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("NameFile"),anObj.NameFile())->ReTagThis("NameFile"));
aRes->AddFils(::ToXMLTree(std::string("NameTag"),anObj.NameTag())->ReTagThis("NameTag"));
if (anObj.AutorizeNonExisting().IsInit())
aRes->AddFils(::ToXMLTree(std::string("AutorizeNonExisting"),anObj.AutorizeNonExisting().Val())->ReTagThis("AutorizeNonExisting"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cSpecExtractFromFile & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameFile(),aTree->Get("NameFile",1)); //tototo
xml_init(anObj.NameTag(),aTree->Get("NameTag",1)); //tototo
xml_init(anObj.AutorizeNonExisting(),aTree->Get("AutorizeNonExisting",1),bool(false)); //tototo
}
std::string Mangling( cSpecExtractFromFile *) {return "EFA2B8327413BCA2FE3F";};
cTplValGesInit< std::string > & cSpecifFormatRaw::NameFile()
{
return mNameFile;
}
const cTplValGesInit< std::string > & cSpecifFormatRaw::NameFile()const
{
return mNameFile;
}
Pt2di & cSpecifFormatRaw::Sz()
{
return mSz;
}
const Pt2di & cSpecifFormatRaw::Sz()const
{
return mSz;
}
bool & cSpecifFormatRaw::MSBF()
{
return mMSBF;
}
const bool & cSpecifFormatRaw::MSBF()const
{
return mMSBF;
}
int & cSpecifFormatRaw::NbBitsParPixel()
{
return mNbBitsParPixel;
}
const int & cSpecifFormatRaw::NbBitsParPixel()const
{
return mNbBitsParPixel;
}
bool & cSpecifFormatRaw::IntegerType()
{
return mIntegerType;
}
const bool & cSpecifFormatRaw::IntegerType()const
{
return mIntegerType;
}
bool & cSpecifFormatRaw::SignedType()
{
return mSignedType;
}
const bool & cSpecifFormatRaw::SignedType()const
{
return mSignedType;
}
cTplValGesInit< int > & cSpecifFormatRaw::Offset()
{
return mOffset;
}
const cTplValGesInit< int > & cSpecifFormatRaw::Offset()const
{
return mOffset;
}
cTplValGesInit< std::string > & cSpecifFormatRaw::Camera()
{
return mCamera;
}
const cTplValGesInit< std::string > & cSpecifFormatRaw::Camera()const
{
return mCamera;
}
cTplValGesInit< std::string > & cSpecifFormatRaw::BayPat()
{
return mBayPat;
}
const cTplValGesInit< std::string > & cSpecifFormatRaw::BayPat()const
{
return mBayPat;
}
cTplValGesInit< double > & cSpecifFormatRaw::Focalmm()
{
return mFocalmm;
}
const cTplValGesInit< double > & cSpecifFormatRaw::Focalmm()const
{
return mFocalmm;
}
cTplValGesInit< double > & cSpecifFormatRaw::FocalEqui35()
{
return mFocalEqui35;
}
const cTplValGesInit< double > & cSpecifFormatRaw::FocalEqui35()const
{
return mFocalEqui35;
}
void BinaryUnDumpFromFile(cSpecifFormatRaw & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NameFile().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NameFile().ValForcedForUnUmp(),aFp);
}
else anObj.NameFile().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.Sz(),aFp);
BinaryUnDumpFromFile(anObj.MSBF(),aFp);
BinaryUnDumpFromFile(anObj.NbBitsParPixel(),aFp);
BinaryUnDumpFromFile(anObj.IntegerType(),aFp);
BinaryUnDumpFromFile(anObj.SignedType(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Offset().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Offset().ValForcedForUnUmp(),aFp);
}
else anObj.Offset().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Camera().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Camera().ValForcedForUnUmp(),aFp);
}
else anObj.Camera().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.BayPat().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.BayPat().ValForcedForUnUmp(),aFp);
}
else anObj.BayPat().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Focalmm().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Focalmm().ValForcedForUnUmp(),aFp);
}
else anObj.Focalmm().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.FocalEqui35().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.FocalEqui35().ValForcedForUnUmp(),aFp);
}
else anObj.FocalEqui35().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cSpecifFormatRaw & anObj)
{
BinaryDumpInFile(aFp,anObj.NameFile().IsInit());
if (anObj.NameFile().IsInit()) BinaryDumpInFile(aFp,anObj.NameFile().Val());
BinaryDumpInFile(aFp,anObj.Sz());
BinaryDumpInFile(aFp,anObj.MSBF());
BinaryDumpInFile(aFp,anObj.NbBitsParPixel());
BinaryDumpInFile(aFp,anObj.IntegerType());
BinaryDumpInFile(aFp,anObj.SignedType());
BinaryDumpInFile(aFp,anObj.Offset().IsInit());
if (anObj.Offset().IsInit()) BinaryDumpInFile(aFp,anObj.Offset().Val());
BinaryDumpInFile(aFp,anObj.Camera().IsInit());
if (anObj.Camera().IsInit()) BinaryDumpInFile(aFp,anObj.Camera().Val());
BinaryDumpInFile(aFp,anObj.BayPat().IsInit());
if (anObj.BayPat().IsInit()) BinaryDumpInFile(aFp,anObj.BayPat().Val());
BinaryDumpInFile(aFp,anObj.Focalmm().IsInit());
if (anObj.Focalmm().IsInit()) BinaryDumpInFile(aFp,anObj.Focalmm().Val());
BinaryDumpInFile(aFp,anObj.FocalEqui35().IsInit());
if (anObj.FocalEqui35().IsInit()) BinaryDumpInFile(aFp,anObj.FocalEqui35().Val());
}
cElXMLTree * ToXMLTree(const cSpecifFormatRaw & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"SpecifFormatRaw",eXMLBranche);
if (anObj.NameFile().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NameFile"),anObj.NameFile().Val())->ReTagThis("NameFile"));
aRes->AddFils(::ToXMLTree(std::string("Sz"),anObj.Sz())->ReTagThis("Sz"));
aRes->AddFils(::ToXMLTree(std::string("MSBF"),anObj.MSBF())->ReTagThis("MSBF"));
aRes->AddFils(::ToXMLTree(std::string("NbBitsParPixel"),anObj.NbBitsParPixel())->ReTagThis("NbBitsParPixel"));
aRes->AddFils(::ToXMLTree(std::string("IntegerType"),anObj.IntegerType())->ReTagThis("IntegerType"));
aRes->AddFils(::ToXMLTree(std::string("SignedType"),anObj.SignedType())->ReTagThis("SignedType"));
if (anObj.Offset().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Offset"),anObj.Offset().Val())->ReTagThis("Offset"));
if (anObj.Camera().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Camera"),anObj.Camera().Val())->ReTagThis("Camera"));
if (anObj.BayPat().IsInit())
aRes->AddFils(::ToXMLTree(std::string("BayPat"),anObj.BayPat().Val())->ReTagThis("BayPat"));
if (anObj.Focalmm().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Focalmm"),anObj.Focalmm().Val())->ReTagThis("Focalmm"));
if (anObj.FocalEqui35().IsInit())
aRes->AddFils(::ToXMLTree(std::string("FocalEqui35"),anObj.FocalEqui35().Val())->ReTagThis("FocalEqui35"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cSpecifFormatRaw & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameFile(),aTree->Get("NameFile",1)); //tototo
xml_init(anObj.Sz(),aTree->Get("Sz",1)); //tototo
xml_init(anObj.MSBF(),aTree->Get("MSBF",1)); //tototo
xml_init(anObj.NbBitsParPixel(),aTree->Get("NbBitsParPixel",1)); //tototo
xml_init(anObj.IntegerType(),aTree->Get("IntegerType",1)); //tototo
xml_init(anObj.SignedType(),aTree->Get("SignedType",1)); //tototo
xml_init(anObj.Offset(),aTree->Get("Offset",1)); //tototo
xml_init(anObj.Camera(),aTree->Get("Camera",1)); //tototo
xml_init(anObj.BayPat(),aTree->Get("BayPat",1)); //tototo
xml_init(anObj.Focalmm(),aTree->Get("Focalmm",1)); //tototo
xml_init(anObj.FocalEqui35(),aTree->Get("FocalEqui35",1)); //tototo
}
std::string Mangling( cSpecifFormatRaw *) {return "F858336FF6E0C8A3FB3F";};
eTotoModeGeomMEC Str2eTotoModeGeomMEC(const std::string & aName)
{
if (aName=="eTotoGeomMECIm1")
return eTotoGeomMECIm1;
else
{
cout << aName << " is not a correct value for enum eTotoModeGeomMEC\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTotoModeGeomMEC) 0;
}
void xml_init(eTotoModeGeomMEC & aVal,cElXMLTree * aTree)
{
aVal= Str2eTotoModeGeomMEC(aTree->Contenu());
}
std::string eToString(const eTotoModeGeomMEC & anObj)
{
if (anObj==eTotoGeomMECIm1)
return "eTotoGeomMECIm1";
std::cout << "Enum = eTotoModeGeomMEC\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTotoModeGeomMEC & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTotoModeGeomMEC & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTotoModeGeomMEC & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTotoModeGeomMEC) aIVal;
}
std::string Mangling( eTotoModeGeomMEC *) {return "76D08D033F65F3A7FE3F";};
std::string & cCM_Set::KeySet()
{
return mKeySet;
}
const std::string & cCM_Set::KeySet()const
{
return mKeySet;
}
cTplValGesInit< std::string > & cCM_Set::KeyAssoc()
{
return mKeyAssoc;
}
const cTplValGesInit< std::string > & cCM_Set::KeyAssoc()const
{
return mKeyAssoc;
}
std::string & cCM_Set::NameVarMap()
{
return mNameVarMap;
}
const std::string & cCM_Set::NameVarMap()const
{
return mNameVarMap;
}
void BinaryUnDumpFromFile(cCM_Set & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.KeySet(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.KeyAssoc().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.KeyAssoc().ValForcedForUnUmp(),aFp);
}
else anObj.KeyAssoc().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.NameVarMap(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCM_Set & anObj)
{
BinaryDumpInFile(aFp,anObj.KeySet());
BinaryDumpInFile(aFp,anObj.KeyAssoc().IsInit());
if (anObj.KeyAssoc().IsInit()) BinaryDumpInFile(aFp,anObj.KeyAssoc().Val());
BinaryDumpInFile(aFp,anObj.NameVarMap());
}
cElXMLTree * ToXMLTree(const cCM_Set & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CM_Set",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("KeySet"),anObj.KeySet())->ReTagThis("KeySet"));
if (anObj.KeyAssoc().IsInit())
aRes->AddFils(::ToXMLTree(std::string("KeyAssoc"),anObj.KeyAssoc().Val())->ReTagThis("KeyAssoc"));
aRes->AddFils(::ToXMLTree(std::string("NameVarMap"),anObj.NameVarMap())->ReTagThis("NameVarMap"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCM_Set & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeySet(),aTree->Get("KeySet",1)); //tototo
xml_init(anObj.KeyAssoc(),aTree->Get("KeyAssoc",1)); //tototo
xml_init(anObj.NameVarMap(),aTree->Get("NameVarMap",1)); //tototo
}
std::string Mangling( cCM_Set *) {return "A034136F47F70091FCBF";};
cTplValGesInit< std::string > & cModeCmdMapeur::CM_One()
{
return mCM_One;
}
const cTplValGesInit< std::string > & cModeCmdMapeur::CM_One()const
{
return mCM_One;
}
std::string & cModeCmdMapeur::KeySet()
{
return CM_Set().Val().KeySet();
}
const std::string & cModeCmdMapeur::KeySet()const
{
return CM_Set().Val().KeySet();
}
cTplValGesInit< std::string > & cModeCmdMapeur::KeyAssoc()
{
return CM_Set().Val().KeyAssoc();
}
const cTplValGesInit< std::string > & cModeCmdMapeur::KeyAssoc()const
{
return CM_Set().Val().KeyAssoc();
}
std::string & cModeCmdMapeur::NameVarMap()
{
return CM_Set().Val().NameVarMap();
}
const std::string & cModeCmdMapeur::NameVarMap()const
{
return CM_Set().Val().NameVarMap();
}
cTplValGesInit< cCM_Set > & cModeCmdMapeur::CM_Set()
{
return mCM_Set;
}
const cTplValGesInit< cCM_Set > & cModeCmdMapeur::CM_Set()const
{
return mCM_Set;
}
void BinaryUnDumpFromFile(cModeCmdMapeur & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.CM_One().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.CM_One().ValForcedForUnUmp(),aFp);
}
else anObj.CM_One().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.CM_Set().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.CM_Set().ValForcedForUnUmp(),aFp);
}
else anObj.CM_Set().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cModeCmdMapeur & anObj)
{
BinaryDumpInFile(aFp,anObj.CM_One().IsInit());
if (anObj.CM_One().IsInit()) BinaryDumpInFile(aFp,anObj.CM_One().Val());
BinaryDumpInFile(aFp,anObj.CM_Set().IsInit());
if (anObj.CM_Set().IsInit()) BinaryDumpInFile(aFp,anObj.CM_Set().Val());
}
cElXMLTree * ToXMLTree(const cModeCmdMapeur & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ModeCmdMapeur",eXMLBranche);
if (anObj.CM_One().IsInit())
aRes->AddFils(::ToXMLTree(std::string("CM_One"),anObj.CM_One().Val())->ReTagThis("CM_One"));
if (anObj.CM_Set().IsInit())
aRes->AddFils(ToXMLTree(anObj.CM_Set().Val())->ReTagThis("CM_Set"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cModeCmdMapeur & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.CM_One(),aTree->Get("CM_One",1)); //tototo
xml_init(anObj.CM_Set(),aTree->Get("CM_Set",1)); //tototo
}
std::string Mangling( cModeCmdMapeur *) {return "08D14E7A84D6DF95FF3F";};
std::string & cCmdMapRel::KeyRel()
{
return mKeyRel;
}
const std::string & cCmdMapRel::KeyRel()const
{
return mKeyRel;
}
std::string & cCmdMapRel::NameArc()
{
return mNameArc;
}
const std::string & cCmdMapRel::NameArc()const
{
return mNameArc;
}
void BinaryUnDumpFromFile(cCmdMapRel & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.KeyRel(),aFp);
BinaryUnDumpFromFile(anObj.NameArc(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCmdMapRel & anObj)
{
BinaryDumpInFile(aFp,anObj.KeyRel());
BinaryDumpInFile(aFp,anObj.NameArc());
}
cElXMLTree * ToXMLTree(const cCmdMapRel & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CmdMapRel",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("KeyRel"),anObj.KeyRel())->ReTagThis("KeyRel"));
aRes->AddFils(::ToXMLTree(std::string("NameArc"),anObj.NameArc())->ReTagThis("NameArc"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCmdMapRel & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeyRel(),aTree->Get("KeyRel",1)); //tototo
xml_init(anObj.NameArc(),aTree->Get("NameArc",1)); //tototo
}
std::string Mangling( cCmdMapRel *) {return "C290D528177F4287FF3F";};
std::list< cCpleString > & cCMVA::NV()
{
return mNV;
}
const std::list< cCpleString > & cCMVA::NV()const
{
return mNV;
}
void BinaryUnDumpFromFile(cCMVA & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cCpleString aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.NV().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCMVA & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.NV().size());
for( std::list< cCpleString >::const_iterator iT=anObj.NV().begin();
iT!=anObj.NV().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cCMVA & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CMVA",eXMLBranche);
for
( std::list< cCpleString >::const_iterator it=anObj.NV().begin();
it !=anObj.NV().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("NV"),(*it))->ReTagThis("NV"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCMVA & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NV(),aTree->GetAll("NV",false,1));
}
std::string Mangling( cCMVA *) {return "4A667F354B2CD882FD3F";};
bool & cCmdMappeur::ActivateCmdMap()
{
return mActivateCmdMap;
}
const bool & cCmdMappeur::ActivateCmdMap()const
{
return mActivateCmdMap;
}
cTplValGesInit< std::string > & cCmdMappeur::CM_One()
{
return ModeCmdMapeur().CM_One();
}
const cTplValGesInit< std::string > & cCmdMappeur::CM_One()const
{
return ModeCmdMapeur().CM_One();
}
std::string & cCmdMappeur::KeySet()
{
return ModeCmdMapeur().CM_Set().Val().KeySet();
}
const std::string & cCmdMappeur::KeySet()const
{
return ModeCmdMapeur().CM_Set().Val().KeySet();
}
cTplValGesInit< std::string > & cCmdMappeur::KeyAssoc()
{
return ModeCmdMapeur().CM_Set().Val().KeyAssoc();
}
const cTplValGesInit< std::string > & cCmdMappeur::KeyAssoc()const
{
return ModeCmdMapeur().CM_Set().Val().KeyAssoc();
}
std::string & cCmdMappeur::NameVarMap()
{
return ModeCmdMapeur().CM_Set().Val().NameVarMap();
}
const std::string & cCmdMappeur::NameVarMap()const
{
return ModeCmdMapeur().CM_Set().Val().NameVarMap();
}
cTplValGesInit< cCM_Set > & cCmdMappeur::CM_Set()
{
return ModeCmdMapeur().CM_Set();
}
const cTplValGesInit< cCM_Set > & cCmdMappeur::CM_Set()const
{
return ModeCmdMapeur().CM_Set();
}
cModeCmdMapeur & cCmdMappeur::ModeCmdMapeur()
{
return mModeCmdMapeur;
}
const cModeCmdMapeur & cCmdMappeur::ModeCmdMapeur()const
{
return mModeCmdMapeur;
}
std::string & cCmdMappeur::KeyRel()
{
return CmdMapRel().Val().KeyRel();
}
const std::string & cCmdMappeur::KeyRel()const
{
return CmdMapRel().Val().KeyRel();
}
std::string & cCmdMappeur::NameArc()
{
return CmdMapRel().Val().NameArc();
}
const std::string & cCmdMappeur::NameArc()const
{
return CmdMapRel().Val().NameArc();
}
cTplValGesInit< cCmdMapRel > & cCmdMappeur::CmdMapRel()
{
return mCmdMapRel;
}
const cTplValGesInit< cCmdMapRel > & cCmdMappeur::CmdMapRel()const
{
return mCmdMapRel;
}
std::list< cCMVA > & cCmdMappeur::CMVA()
{
return mCMVA;
}
const std::list< cCMVA > & cCmdMappeur::CMVA()const
{
return mCMVA;
}
cTplValGesInit< std::string > & cCmdMappeur::ByMkF()
{
return mByMkF;
}
const cTplValGesInit< std::string > & cCmdMappeur::ByMkF()const
{
return mByMkF;
}
cTplValGesInit< std::string > & cCmdMappeur::KeyTargetMkF()
{
return mKeyTargetMkF;
}
const cTplValGesInit< std::string > & cCmdMappeur::KeyTargetMkF()const
{
return mKeyTargetMkF;
}
void BinaryUnDumpFromFile(cCmdMappeur & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.ActivateCmdMap(),aFp);
BinaryUnDumpFromFile(anObj.ModeCmdMapeur(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.CmdMapRel().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.CmdMapRel().ValForcedForUnUmp(),aFp);
}
else anObj.CmdMapRel().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cCMVA aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.CMVA().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ByMkF().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ByMkF().ValForcedForUnUmp(),aFp);
}
else anObj.ByMkF().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.KeyTargetMkF().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.KeyTargetMkF().ValForcedForUnUmp(),aFp);
}
else anObj.KeyTargetMkF().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCmdMappeur & anObj)
{
BinaryDumpInFile(aFp,anObj.ActivateCmdMap());
BinaryDumpInFile(aFp,anObj.ModeCmdMapeur());
BinaryDumpInFile(aFp,anObj.CmdMapRel().IsInit());
if (anObj.CmdMapRel().IsInit()) BinaryDumpInFile(aFp,anObj.CmdMapRel().Val());
BinaryDumpInFile(aFp,(int)anObj.CMVA().size());
for( std::list< cCMVA >::const_iterator iT=anObj.CMVA().begin();
iT!=anObj.CMVA().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.ByMkF().IsInit());
if (anObj.ByMkF().IsInit()) BinaryDumpInFile(aFp,anObj.ByMkF().Val());
BinaryDumpInFile(aFp,anObj.KeyTargetMkF().IsInit());
if (anObj.KeyTargetMkF().IsInit()) BinaryDumpInFile(aFp,anObj.KeyTargetMkF().Val());
}
cElXMLTree * ToXMLTree(const cCmdMappeur & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CmdMappeur",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("ActivateCmdMap"),anObj.ActivateCmdMap())->ReTagThis("ActivateCmdMap"));
aRes->AddFils(ToXMLTree(anObj.ModeCmdMapeur())->ReTagThis("ModeCmdMapeur"));
if (anObj.CmdMapRel().IsInit())
aRes->AddFils(ToXMLTree(anObj.CmdMapRel().Val())->ReTagThis("CmdMapRel"));
for
( std::list< cCMVA >::const_iterator it=anObj.CMVA().begin();
it !=anObj.CMVA().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("CMVA"));
if (anObj.ByMkF().IsInit())
aRes->AddFils(::ToXMLTree(std::string("ByMkF"),anObj.ByMkF().Val())->ReTagThis("ByMkF"));
if (anObj.KeyTargetMkF().IsInit())
aRes->AddFils(::ToXMLTree(std::string("KeyTargetMkF"),anObj.KeyTargetMkF().Val())->ReTagThis("KeyTargetMkF"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCmdMappeur & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.ActivateCmdMap(),aTree->Get("ActivateCmdMap",1)); //tototo
xml_init(anObj.ModeCmdMapeur(),aTree->Get("ModeCmdMapeur",1)); //tototo
xml_init(anObj.CmdMapRel(),aTree->Get("CmdMapRel",1)); //tototo
xml_init(anObj.CMVA(),aTree->GetAll("CMVA",false,1));
xml_init(anObj.ByMkF(),aTree->Get("ByMkF",1)); //tototo
xml_init(anObj.KeyTargetMkF(),aTree->Get("KeyTargetMkF",1)); //tototo
}
std::string Mangling( cCmdMappeur *) {return "19F049934C430E87FEBF";};
std::list< std::string > & cOneCmdPar::OneCmdSer()
{
return mOneCmdSer;
}
const std::list< std::string > & cOneCmdPar::OneCmdSer()const
{
return mOneCmdSer;
}
void BinaryUnDumpFromFile(cOneCmdPar & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.OneCmdSer().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cOneCmdPar & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.OneCmdSer().size());
for( std::list< std::string >::const_iterator iT=anObj.OneCmdSer().begin();
iT!=anObj.OneCmdSer().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cOneCmdPar & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"OneCmdPar",eXMLBranche);
for
( std::list< std::string >::const_iterator it=anObj.OneCmdSer().begin();
it !=anObj.OneCmdSer().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("OneCmdSer"),(*it))->ReTagThis("OneCmdSer"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cOneCmdPar & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.OneCmdSer(),aTree->GetAll("OneCmdSer",false,1));
}
std::string Mangling( cOneCmdPar *) {return "0AE4B59974B020B3FDBF";};
cTplValGesInit< std::string > & cCmdExePar::NameMkF()
{
return mNameMkF;
}
const cTplValGesInit< std::string > & cCmdExePar::NameMkF()const
{
return mNameMkF;
}
std::list< cOneCmdPar > & cCmdExePar::OneCmdPar()
{
return mOneCmdPar;
}
const std::list< cOneCmdPar > & cCmdExePar::OneCmdPar()const
{
return mOneCmdPar;
}
void BinaryUnDumpFromFile(cCmdExePar & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NameMkF().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NameMkF().ValForcedForUnUmp(),aFp);
}
else anObj.NameMkF().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cOneCmdPar aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.OneCmdPar().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCmdExePar & anObj)
{
BinaryDumpInFile(aFp,anObj.NameMkF().IsInit());
if (anObj.NameMkF().IsInit()) BinaryDumpInFile(aFp,anObj.NameMkF().Val());
BinaryDumpInFile(aFp,(int)anObj.OneCmdPar().size());
for( std::list< cOneCmdPar >::const_iterator iT=anObj.OneCmdPar().begin();
iT!=anObj.OneCmdPar().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cCmdExePar & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CmdExePar",eXMLBranche);
if (anObj.NameMkF().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NameMkF"),anObj.NameMkF().Val())->ReTagThis("NameMkF"));
for
( std::list< cOneCmdPar >::const_iterator it=anObj.OneCmdPar().begin();
it !=anObj.OneCmdPar().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("OneCmdPar"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCmdExePar & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameMkF(),aTree->Get("NameMkF",1),std::string("Make_CmdExePar")); //tototo
xml_init(anObj.OneCmdPar(),aTree->GetAll("OneCmdPar",false,1));
}
std::string Mangling( cCmdExePar *) {return "B1179A681150E1DCFE3F";};
std::string & cPt3drEntries::Key()
{
return mKey;
}
const std::string & cPt3drEntries::Key()const
{
return mKey;
}
Pt3dr & cPt3drEntries::Val()
{
return mVal;
}
const Pt3dr & cPt3drEntries::Val()const
{
return mVal;
}
void BinaryUnDumpFromFile(cPt3drEntries & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Key(),aFp);
BinaryUnDumpFromFile(anObj.Val(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cPt3drEntries & anObj)
{
BinaryDumpInFile(aFp,anObj.Key());
BinaryDumpInFile(aFp,anObj.Val());
}
cElXMLTree * ToXMLTree(const cPt3drEntries & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"Pt3drEntries",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Key"),anObj.Key())->ReTagThis("Key"));
aRes->AddFils(ToXMLTree(std::string("Val"),anObj.Val())->ReTagThis("Val"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cPt3drEntries & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Key(),aTree->Get("Key",1)); //tototo
xml_init(anObj.Val(),aTree->Get("Val",1)); //tototo
}
std::string Mangling( cPt3drEntries *) {return "70589D0F9ECDC1AEFABF";};
std::string & cBasesPt3dr::NameBase()
{
return mNameBase;
}
const std::string & cBasesPt3dr::NameBase()const
{
return mNameBase;
}
std::list< cPt3drEntries > & cBasesPt3dr::Pt3drEntries()
{
return mPt3drEntries;
}
const std::list< cPt3drEntries > & cBasesPt3dr::Pt3drEntries()const
{
return mPt3drEntries;
}
void BinaryUnDumpFromFile(cBasesPt3dr & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.NameBase(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cPt3drEntries aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Pt3drEntries().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cBasesPt3dr & anObj)
{
BinaryDumpInFile(aFp,anObj.NameBase());
BinaryDumpInFile(aFp,(int)anObj.Pt3drEntries().size());
for( std::list< cPt3drEntries >::const_iterator iT=anObj.Pt3drEntries().begin();
iT!=anObj.Pt3drEntries().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cBasesPt3dr & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"BasesPt3dr",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("NameBase"),anObj.NameBase())->ReTagThis("NameBase"));
for
( std::list< cPt3drEntries >::const_iterator it=anObj.Pt3drEntries().begin();
it !=anObj.Pt3drEntries().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("Pt3drEntries"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cBasesPt3dr & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameBase(),aTree->Get("NameBase",1)); //tototo
xml_init(anObj.Pt3drEntries(),aTree->GetAll("Pt3drEntries",false,1));
}
std::string Mangling( cBasesPt3dr *) {return "21A14CC5147F6F94FF3F";};
std::string & cScalEntries::Key()
{
return mKey;
}
const std::string & cScalEntries::Key()const
{
return mKey;
}
double & cScalEntries::Val()
{
return mVal;
}
const double & cScalEntries::Val()const
{
return mVal;
}
void BinaryUnDumpFromFile(cScalEntries & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Key(),aFp);
BinaryUnDumpFromFile(anObj.Val(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cScalEntries & anObj)
{
BinaryDumpInFile(aFp,anObj.Key());
BinaryDumpInFile(aFp,anObj.Val());
}
cElXMLTree * ToXMLTree(const cScalEntries & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ScalEntries",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Key"),anObj.Key())->ReTagThis("Key"));
aRes->AddFils(::ToXMLTree(std::string("Val"),anObj.Val())->ReTagThis("Val"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cScalEntries & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Key(),aTree->Get("Key",1)); //tototo
xml_init(anObj.Val(),aTree->Get("Val",1)); //tototo
}
std::string Mangling( cScalEntries *) {return "80DCA8833CF83F96FBBF";};
std::string & cBasesScal::NameBase()
{
return mNameBase;
}
const std::string & cBasesScal::NameBase()const
{
return mNameBase;
}
std::list< cScalEntries > & cBasesScal::ScalEntries()
{
return mScalEntries;
}
const std::list< cScalEntries > & cBasesScal::ScalEntries()const
{
return mScalEntries;
}
void BinaryUnDumpFromFile(cBasesScal & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.NameBase(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cScalEntries aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ScalEntries().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cBasesScal & anObj)
{
BinaryDumpInFile(aFp,anObj.NameBase());
BinaryDumpInFile(aFp,(int)anObj.ScalEntries().size());
for( std::list< cScalEntries >::const_iterator iT=anObj.ScalEntries().begin();
iT!=anObj.ScalEntries().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cBasesScal & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"BasesScal",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("NameBase"),anObj.NameBase())->ReTagThis("NameBase"));
for
( std::list< cScalEntries >::const_iterator it=anObj.ScalEntries().begin();
it !=anObj.ScalEntries().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("ScalEntries"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cBasesScal & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameBase(),aTree->Get("NameBase",1)); //tototo
xml_init(anObj.ScalEntries(),aTree->GetAll("ScalEntries",false,1));
}
std::string Mangling( cBasesScal *) {return "20877570057E0CADFD3F";};
std::list< cBasesPt3dr > & cBaseDataCD::BasesPt3dr()
{
return mBasesPt3dr;
}
const std::list< cBasesPt3dr > & cBaseDataCD::BasesPt3dr()const
{
return mBasesPt3dr;
}
std::list< cBasesScal > & cBaseDataCD::BasesScal()
{
return mBasesScal;
}
const std::list< cBasesScal > & cBaseDataCD::BasesScal()const
{
return mBasesScal;
}
void BinaryUnDumpFromFile(cBaseDataCD & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cBasesPt3dr aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.BasesPt3dr().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cBasesScal aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.BasesScal().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cBaseDataCD & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.BasesPt3dr().size());
for( std::list< cBasesPt3dr >::const_iterator iT=anObj.BasesPt3dr().begin();
iT!=anObj.BasesPt3dr().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.BasesScal().size());
for( std::list< cBasesScal >::const_iterator iT=anObj.BasesScal().begin();
iT!=anObj.BasesScal().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cBaseDataCD & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"BaseDataCD",eXMLBranche);
for
( std::list< cBasesPt3dr >::const_iterator it=anObj.BasesPt3dr().begin();
it !=anObj.BasesPt3dr().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("BasesPt3dr"));
for
( std::list< cBasesScal >::const_iterator it=anObj.BasesScal().begin();
it !=anObj.BasesScal().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("BasesScal"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cBaseDataCD & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.BasesPt3dr(),aTree->GetAll("BasesPt3dr",false,1));
xml_init(anObj.BasesScal(),aTree->GetAll("BasesScal",false,1));
}
std::string Mangling( cBaseDataCD *) {return "A702120845BA28F0FE3F";};
std::string & cParamVolChantierPhotogram::Directory()
{
return mDirectory;
}
const std::string & cParamVolChantierPhotogram::Directory()const
{
return mDirectory;
}
cTplValGesInit< std::string > & cParamVolChantierPhotogram::DirOrientations()
{
return mDirOrientations;
}
const cTplValGesInit< std::string > & cParamVolChantierPhotogram::DirOrientations()const
{
return mDirOrientations;
}
cElRegex_Ptr & cParamVolChantierPhotogram::NameSelector()
{
return mNameSelector;
}
const cElRegex_Ptr & cParamVolChantierPhotogram::NameSelector()const
{
return mNameSelector;
}
cElRegex_Ptr & cParamVolChantierPhotogram::BandeIdSelector()
{
return mBandeIdSelector;
}
const cElRegex_Ptr & cParamVolChantierPhotogram::BandeIdSelector()const
{
return mBandeIdSelector;
}
std::string & cParamVolChantierPhotogram::NomBandeId()
{
return mNomBandeId;
}
const std::string & cParamVolChantierPhotogram::NomBandeId()const
{
return mNomBandeId;
}
std::string & cParamVolChantierPhotogram::NomIdInBande()
{
return mNomIdInBande;
}
const std::string & cParamVolChantierPhotogram::NomIdInBande()const
{
return mNomIdInBande;
}
std::string & cParamVolChantierPhotogram::NomImage()
{
return mNomImage;
}
const std::string & cParamVolChantierPhotogram::NomImage()const
{
return mNomImage;
}
cTplValGesInit< std::string > & cParamVolChantierPhotogram::DirImages()
{
return mDirImages;
}
const cTplValGesInit< std::string > & cParamVolChantierPhotogram::DirImages()const
{
return mDirImages;
}
void BinaryUnDumpFromFile(cParamVolChantierPhotogram & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Directory(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.DirOrientations().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.DirOrientations().ValForcedForUnUmp(),aFp);
}
else anObj.DirOrientations().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.NameSelector(),aFp);
BinaryUnDumpFromFile(anObj.BandeIdSelector(),aFp);
BinaryUnDumpFromFile(anObj.NomBandeId(),aFp);
BinaryUnDumpFromFile(anObj.NomIdInBande(),aFp);
BinaryUnDumpFromFile(anObj.NomImage(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.DirImages().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.DirImages().ValForcedForUnUmp(),aFp);
}
else anObj.DirImages().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cParamVolChantierPhotogram & anObj)
{
BinaryDumpInFile(aFp,anObj.Directory());
BinaryDumpInFile(aFp,anObj.DirOrientations().IsInit());
if (anObj.DirOrientations().IsInit()) BinaryDumpInFile(aFp,anObj.DirOrientations().Val());
BinaryDumpInFile(aFp,anObj.NameSelector());
BinaryDumpInFile(aFp,anObj.BandeIdSelector());
BinaryDumpInFile(aFp,anObj.NomBandeId());
BinaryDumpInFile(aFp,anObj.NomIdInBande());
BinaryDumpInFile(aFp,anObj.NomImage());
BinaryDumpInFile(aFp,anObj.DirImages().IsInit());
if (anObj.DirImages().IsInit()) BinaryDumpInFile(aFp,anObj.DirImages().Val());
}
cElXMLTree * ToXMLTree(const cParamVolChantierPhotogram & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ParamVolChantierPhotogram",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Directory"),anObj.Directory())->ReTagThis("Directory"));
if (anObj.DirOrientations().IsInit())
aRes->AddFils(::ToXMLTree(std::string("DirOrientations"),anObj.DirOrientations().Val())->ReTagThis("DirOrientations"));
aRes->AddFils(::ToXMLTree(std::string("NameSelector"),anObj.NameSelector())->ReTagThis("NameSelector"));
aRes->AddFils(::ToXMLTree(std::string("BandeIdSelector"),anObj.BandeIdSelector())->ReTagThis("BandeIdSelector"));
aRes->AddFils(::ToXMLTree(std::string("NomBandeId"),anObj.NomBandeId())->ReTagThis("NomBandeId"));
aRes->AddFils(::ToXMLTree(std::string("NomIdInBande"),anObj.NomIdInBande())->ReTagThis("NomIdInBande"));
aRes->AddFils(::ToXMLTree(std::string("NomImage"),anObj.NomImage())->ReTagThis("NomImage"));
if (anObj.DirImages().IsInit())
aRes->AddFils(::ToXMLTree(std::string("DirImages"),anObj.DirImages().Val())->ReTagThis("DirImages"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cParamVolChantierPhotogram & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Directory(),aTree->Get("Directory",1)); //tototo
xml_init(anObj.DirOrientations(),aTree->Get("DirOrientations",1),std::string("")); //tototo
xml_init(anObj.NameSelector(),aTree->Get("NameSelector",1)); //tototo
xml_init(anObj.BandeIdSelector(),aTree->Get("BandeIdSelector",1)); //tototo
xml_init(anObj.NomBandeId(),aTree->Get("NomBandeId",1)); //tototo
xml_init(anObj.NomIdInBande(),aTree->Get("NomIdInBande",1)); //tototo
xml_init(anObj.NomImage(),aTree->Get("NomImage",1)); //tototo
xml_init(anObj.DirImages(),aTree->Get("DirImages",1),std::string("")); //tototo
}
std::string Mangling( cParamVolChantierPhotogram *) {return "2BBFCDD9DDF060E9FE3F";};
std::list< cParamVolChantierPhotogram > & cParamChantierPhotogram::ParamVolChantierPhotogram()
{
return mParamVolChantierPhotogram;
}
const std::list< cParamVolChantierPhotogram > & cParamChantierPhotogram::ParamVolChantierPhotogram()const
{
return mParamVolChantierPhotogram;
}
void BinaryUnDumpFromFile(cParamChantierPhotogram & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cParamVolChantierPhotogram aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ParamVolChantierPhotogram().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cParamChantierPhotogram & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.ParamVolChantierPhotogram().size());
for( std::list< cParamVolChantierPhotogram >::const_iterator iT=anObj.ParamVolChantierPhotogram().begin();
iT!=anObj.ParamVolChantierPhotogram().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cParamChantierPhotogram & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ParamChantierPhotogram",eXMLBranche);
for
( std::list< cParamVolChantierPhotogram >::const_iterator it=anObj.ParamVolChantierPhotogram().begin();
it !=anObj.ParamVolChantierPhotogram().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("ParamVolChantierPhotogram"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cParamChantierPhotogram & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.ParamVolChantierPhotogram(),aTree->GetAll("ParamVolChantierPhotogram",false,1));
}
std::string Mangling( cParamChantierPhotogram *) {return "E207D588A3D944A2FF3F";};
std::string & cPDV::Im()
{
return mIm;
}
const std::string & cPDV::Im()const
{
return mIm;
}
std::string & cPDV::Orient()
{
return mOrient;
}
const std::string & cPDV::Orient()const
{
return mOrient;
}
std::string & cPDV::IdInBande()
{
return mIdInBande;
}
const std::string & cPDV::IdInBande()const
{
return mIdInBande;
}
std::string & cPDV::Bande()
{
return mBande;
}
const std::string & cPDV::Bande()const
{
return mBande;
}
void BinaryUnDumpFromFile(cPDV & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Im(),aFp);
BinaryUnDumpFromFile(anObj.Orient(),aFp);
BinaryUnDumpFromFile(anObj.IdInBande(),aFp);
BinaryUnDumpFromFile(anObj.Bande(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cPDV & anObj)
{
BinaryDumpInFile(aFp,anObj.Im());
BinaryDumpInFile(aFp,anObj.Orient());
BinaryDumpInFile(aFp,anObj.IdInBande());
BinaryDumpInFile(aFp,anObj.Bande());
}
cElXMLTree * ToXMLTree(const cPDV & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"PDV",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Im"),anObj.Im())->ReTagThis("Im"));
aRes->AddFils(::ToXMLTree(std::string("Orient"),anObj.Orient())->ReTagThis("Orient"));
aRes->AddFils(::ToXMLTree(std::string("IdInBande"),anObj.IdInBande())->ReTagThis("IdInBande"));
aRes->AddFils(::ToXMLTree(std::string("Bande"),anObj.Bande())->ReTagThis("Bande"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cPDV & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Im(),aTree->Get("Im",1)); //tototo
xml_init(anObj.Orient(),aTree->Get("Orient",1)); //tototo
xml_init(anObj.IdInBande(),aTree->Get("IdInBande",1)); //tototo
xml_init(anObj.Bande(),aTree->Get("Bande",1)); //tototo
}
std::string Mangling( cPDV *) {return "B49AD249889AB7DCFD3F";};
std::string & cBandesChantierPhotogram::IdBande()
{
return mIdBande;
}
const std::string & cBandesChantierPhotogram::IdBande()const
{
return mIdBande;
}
std::list< cPDV > & cBandesChantierPhotogram::PDVs()
{
return mPDVs;
}
const std::list< cPDV > & cBandesChantierPhotogram::PDVs()const
{
return mPDVs;
}
void BinaryUnDumpFromFile(cBandesChantierPhotogram & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.IdBande(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cPDV aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.PDVs().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cBandesChantierPhotogram & anObj)
{
BinaryDumpInFile(aFp,anObj.IdBande());
BinaryDumpInFile(aFp,(int)anObj.PDVs().size());
for( std::list< cPDV >::const_iterator iT=anObj.PDVs().begin();
iT!=anObj.PDVs().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cBandesChantierPhotogram & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"BandesChantierPhotogram",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("IdBande"),anObj.IdBande())->ReTagThis("IdBande"));
for
( std::list< cPDV >::const_iterator it=anObj.PDVs().begin();
it !=anObj.PDVs().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("PDVs"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cBandesChantierPhotogram & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.IdBande(),aTree->Get("IdBande",1)); //tototo
xml_init(anObj.PDVs(),aTree->GetAll("PDVs",false,1));
}
std::string Mangling( cBandesChantierPhotogram *) {return "209A6C9EE647C191FABF";};
std::list< cBandesChantierPhotogram > & cVolChantierPhotogram::BandesChantierPhotogram()
{
return mBandesChantierPhotogram;
}
const std::list< cBandesChantierPhotogram > & cVolChantierPhotogram::BandesChantierPhotogram()const
{
return mBandesChantierPhotogram;
}
void BinaryUnDumpFromFile(cVolChantierPhotogram & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cBandesChantierPhotogram aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.BandesChantierPhotogram().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cVolChantierPhotogram & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.BandesChantierPhotogram().size());
for( std::list< cBandesChantierPhotogram >::const_iterator iT=anObj.BandesChantierPhotogram().begin();
iT!=anObj.BandesChantierPhotogram().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cVolChantierPhotogram & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"VolChantierPhotogram",eXMLBranche);
for
( std::list< cBandesChantierPhotogram >::const_iterator it=anObj.BandesChantierPhotogram().begin();
it !=anObj.BandesChantierPhotogram().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("BandesChantierPhotogram"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cVolChantierPhotogram & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.BandesChantierPhotogram(),aTree->GetAll("BandesChantierPhotogram",false,1));
}
std::string Mangling( cVolChantierPhotogram *) {return "18690A7D391663B1FF3F";};
std::list< cVolChantierPhotogram > & cChantierPhotogram::VolChantierPhotogram()
{
return mVolChantierPhotogram;
}
const std::list< cVolChantierPhotogram > & cChantierPhotogram::VolChantierPhotogram()const
{
return mVolChantierPhotogram;
}
void BinaryUnDumpFromFile(cChantierPhotogram & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cVolChantierPhotogram aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.VolChantierPhotogram().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cChantierPhotogram & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.VolChantierPhotogram().size());
for( std::list< cVolChantierPhotogram >::const_iterator iT=anObj.VolChantierPhotogram().begin();
iT!=anObj.VolChantierPhotogram().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cChantierPhotogram & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ChantierPhotogram",eXMLBranche);
for
( std::list< cVolChantierPhotogram >::const_iterator it=anObj.VolChantierPhotogram().begin();
it !=anObj.VolChantierPhotogram().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("VolChantierPhotogram"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cChantierPhotogram & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.VolChantierPhotogram(),aTree->GetAll("VolChantierPhotogram",false,1));
}
std::string Mangling( cChantierPhotogram *) {return "0A0BF8772D8C999FFDBF";};
int & cCplePDV::Id1()
{
return mId1;
}
const int & cCplePDV::Id1()const
{
return mId1;
}
int & cCplePDV::Id2()
{
return mId2;
}
const int & cCplePDV::Id2()const
{
return mId2;
}
void BinaryUnDumpFromFile(cCplePDV & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Id1(),aFp);
BinaryUnDumpFromFile(anObj.Id2(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCplePDV & anObj)
{
BinaryDumpInFile(aFp,anObj.Id1());
BinaryDumpInFile(aFp,anObj.Id2());
}
cElXMLTree * ToXMLTree(const cCplePDV & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CplePDV",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Id1"),anObj.Id1())->ReTagThis("Id1"));
aRes->AddFils(::ToXMLTree(std::string("Id2"),anObj.Id2())->ReTagThis("Id2"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCplePDV & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Id1(),aTree->Get("Id1",1)); //tototo
xml_init(anObj.Id2(),aTree->Get("Id2",1)); //tototo
}
std::string Mangling( cCplePDV *) {return "1006E33477C681E7F9BF";};
Box2dr & cGraphePdv::BoxCh()
{
return mBoxCh;
}
const Box2dr & cGraphePdv::BoxCh()const
{
return mBoxCh;
}
std::vector< cPDV > & cGraphePdv::PDVs()
{
return mPDVs;
}
const std::vector< cPDV > & cGraphePdv::PDVs()const
{
return mPDVs;
}
std::list< cCplePDV > & cGraphePdv::CplePDV()
{
return mCplePDV;
}
const std::list< cCplePDV > & cGraphePdv::CplePDV()const
{
return mCplePDV;
}
void BinaryUnDumpFromFile(cGraphePdv & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.BoxCh(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cPDV aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.PDVs().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cCplePDV aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.CplePDV().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cGraphePdv & anObj)
{
BinaryDumpInFile(aFp,anObj.BoxCh());
BinaryDumpInFile(aFp,(int)anObj.PDVs().size());
for( std::vector< cPDV >::const_iterator iT=anObj.PDVs().begin();
iT!=anObj.PDVs().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.CplePDV().size());
for( std::list< cCplePDV >::const_iterator iT=anObj.CplePDV().begin();
iT!=anObj.CplePDV().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cGraphePdv & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"GraphePdv",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("BoxCh"),anObj.BoxCh())->ReTagThis("BoxCh"));
for
( std::vector< cPDV >::const_iterator it=anObj.PDVs().begin();
it !=anObj.PDVs().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("PDVs"));
for
( std::list< cCplePDV >::const_iterator it=anObj.CplePDV().begin();
it !=anObj.CplePDV().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("CplePDV"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cGraphePdv & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.BoxCh(),aTree->Get("BoxCh",1)); //tototo
xml_init(anObj.PDVs(),aTree->GetAll("PDVs",false,1));
xml_init(anObj.CplePDV(),aTree->GetAll("CplePDV",false,1));
}
std::string Mangling( cGraphePdv *) {return "CC046832CCAD54B6FE3F";};
double & cCercleRelief::Rayon()
{
return mRayon;
}
const double & cCercleRelief::Rayon()const
{
return mRayon;
}
double & cCercleRelief::Profondeur()
{
return mProfondeur;
}
const double & cCercleRelief::Profondeur()const
{
return mProfondeur;
}
void BinaryUnDumpFromFile(cCercleRelief & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Rayon(),aFp);
BinaryUnDumpFromFile(anObj.Profondeur(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCercleRelief & anObj)
{
BinaryDumpInFile(aFp,anObj.Rayon());
BinaryDumpInFile(aFp,anObj.Profondeur());
}
cElXMLTree * ToXMLTree(const cCercleRelief & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CercleRelief",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Rayon"),anObj.Rayon())->ReTagThis("Rayon"));
aRes->AddFils(::ToXMLTree(std::string("Profondeur"),anObj.Profondeur())->ReTagThis("Profondeur"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCercleRelief & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Rayon(),aTree->Get("Rayon",1)); //tototo
xml_init(anObj.Profondeur(),aTree->Get("Profondeur",1)); //tototo
}
std::string Mangling( cCercleRelief *) {return "D083307149A56D90FA3F";};
int & cCibleCalib::Id()
{
return mId;
}
const int & cCibleCalib::Id()const
{
return mId;
}
cTplValGesInit< bool > & cCibleCalib::Negatif()
{
return mNegatif;
}
const cTplValGesInit< bool > & cCibleCalib::Negatif()const
{
return mNegatif;
}
Pt3dr & cCibleCalib::Position()
{
return mPosition;
}
const Pt3dr & cCibleCalib::Position()const
{
return mPosition;
}
Pt3dr & cCibleCalib::Normale()
{
return mNormale;
}
const Pt3dr & cCibleCalib::Normale()const
{
return mNormale;
}
std::vector< double > & cCibleCalib::Rayons()
{
return mRayons;
}
const std::vector< double > & cCibleCalib::Rayons()const
{
return mRayons;
}
bool & cCibleCalib::Ponctuel()
{
return mPonctuel;
}
const bool & cCibleCalib::Ponctuel()const
{
return mPonctuel;
}
bool & cCibleCalib::ReliefIsSortant()
{
return mReliefIsSortant;
}
const bool & cCibleCalib::ReliefIsSortant()const
{
return mReliefIsSortant;
}
std::vector< cCercleRelief > & cCibleCalib::CercleRelief()
{
return mCercleRelief;
}
const std::vector< cCercleRelief > & cCibleCalib::CercleRelief()const
{
return mCercleRelief;
}
std::string & cCibleCalib::NomType()
{
return mNomType;
}
const std::string & cCibleCalib::NomType()const
{
return mNomType;
}
int & cCibleCalib::Qualite()
{
return mQualite;
}
const int & cCibleCalib::Qualite()const
{
return mQualite;
}
cTplValGesInit< double > & cCibleCalib::FacteurElargRechCorrel()
{
return mFacteurElargRechCorrel;
}
const cTplValGesInit< double > & cCibleCalib::FacteurElargRechCorrel()const
{
return mFacteurElargRechCorrel;
}
cTplValGesInit< double > & cCibleCalib::FacteurElargRechRaffine()
{
return mFacteurElargRechRaffine;
}
const cTplValGesInit< double > & cCibleCalib::FacteurElargRechRaffine()const
{
return mFacteurElargRechRaffine;
}
void BinaryUnDumpFromFile(cCibleCalib & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Id(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Negatif().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Negatif().ValForcedForUnUmp(),aFp);
}
else anObj.Negatif().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.Position(),aFp);
BinaryUnDumpFromFile(anObj.Normale(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
double aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Rayons().push_back(aVal);
}
} ;
BinaryUnDumpFromFile(anObj.Ponctuel(),aFp);
BinaryUnDumpFromFile(anObj.ReliefIsSortant(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cCercleRelief aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.CercleRelief().push_back(aVal);
}
} ;
BinaryUnDumpFromFile(anObj.NomType(),aFp);
BinaryUnDumpFromFile(anObj.Qualite(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.FacteurElargRechCorrel().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.FacteurElargRechCorrel().ValForcedForUnUmp(),aFp);
}
else anObj.FacteurElargRechCorrel().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.FacteurElargRechRaffine().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.FacteurElargRechRaffine().ValForcedForUnUmp(),aFp);
}
else anObj.FacteurElargRechRaffine().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCibleCalib & anObj)
{
BinaryDumpInFile(aFp,anObj.Id());
BinaryDumpInFile(aFp,anObj.Negatif().IsInit());
if (anObj.Negatif().IsInit()) BinaryDumpInFile(aFp,anObj.Negatif().Val());
BinaryDumpInFile(aFp,anObj.Position());
BinaryDumpInFile(aFp,anObj.Normale());
BinaryDumpInFile(aFp,(int)anObj.Rayons().size());
for( std::vector< double >::const_iterator iT=anObj.Rayons().begin();
iT!=anObj.Rayons().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.Ponctuel());
BinaryDumpInFile(aFp,anObj.ReliefIsSortant());
BinaryDumpInFile(aFp,(int)anObj.CercleRelief().size());
for( std::vector< cCercleRelief >::const_iterator iT=anObj.CercleRelief().begin();
iT!=anObj.CercleRelief().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.NomType());
BinaryDumpInFile(aFp,anObj.Qualite());
BinaryDumpInFile(aFp,anObj.FacteurElargRechCorrel().IsInit());
if (anObj.FacteurElargRechCorrel().IsInit()) BinaryDumpInFile(aFp,anObj.FacteurElargRechCorrel().Val());
BinaryDumpInFile(aFp,anObj.FacteurElargRechRaffine().IsInit());
if (anObj.FacteurElargRechRaffine().IsInit()) BinaryDumpInFile(aFp,anObj.FacteurElargRechRaffine().Val());
}
cElXMLTree * ToXMLTree(const cCibleCalib & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CibleCalib",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Id"),anObj.Id())->ReTagThis("Id"));
if (anObj.Negatif().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Negatif"),anObj.Negatif().Val())->ReTagThis("Negatif"));
aRes->AddFils(ToXMLTree(std::string("Position"),anObj.Position())->ReTagThis("Position"));
aRes->AddFils(ToXMLTree(std::string("Normale"),anObj.Normale())->ReTagThis("Normale"));
for
( std::vector< double >::const_iterator it=anObj.Rayons().begin();
it !=anObj.Rayons().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Rayons"),(*it))->ReTagThis("Rayons"));
aRes->AddFils(::ToXMLTree(std::string("Ponctuel"),anObj.Ponctuel())->ReTagThis("Ponctuel"));
aRes->AddFils(::ToXMLTree(std::string("ReliefIsSortant"),anObj.ReliefIsSortant())->ReTagThis("ReliefIsSortant"));
for
( std::vector< cCercleRelief >::const_iterator it=anObj.CercleRelief().begin();
it !=anObj.CercleRelief().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("CercleRelief"));
aRes->AddFils(::ToXMLTree(std::string("NomType"),anObj.NomType())->ReTagThis("NomType"));
aRes->AddFils(::ToXMLTree(std::string("Qualite"),anObj.Qualite())->ReTagThis("Qualite"));
if (anObj.FacteurElargRechCorrel().IsInit())
aRes->AddFils(::ToXMLTree(std::string("FacteurElargRechCorrel"),anObj.FacteurElargRechCorrel().Val())->ReTagThis("FacteurElargRechCorrel"));
if (anObj.FacteurElargRechRaffine().IsInit())
aRes->AddFils(::ToXMLTree(std::string("FacteurElargRechRaffine"),anObj.FacteurElargRechRaffine().Val())->ReTagThis("FacteurElargRechRaffine"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCibleCalib & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Id(),aTree->Get("Id",1)); //tototo
xml_init(anObj.Negatif(),aTree->Get("Negatif",1),bool(false)); //tototo
xml_init(anObj.Position(),aTree->Get("Position",1)); //tototo
xml_init(anObj.Normale(),aTree->Get("Normale",1)); //tototo
xml_init(anObj.Rayons(),aTree->GetAll("Rayons",false,1));
xml_init(anObj.Ponctuel(),aTree->Get("Ponctuel",1)); //tototo
xml_init(anObj.ReliefIsSortant(),aTree->Get("ReliefIsSortant",1)); //tototo
xml_init(anObj.CercleRelief(),aTree->GetAll("CercleRelief",false,1));
xml_init(anObj.NomType(),aTree->Get("NomType",1)); //tototo
xml_init(anObj.Qualite(),aTree->Get("Qualite",1)); //tototo
xml_init(anObj.FacteurElargRechCorrel(),aTree->Get("FacteurElargRechCorrel",1)); //tototo
xml_init(anObj.FacteurElargRechRaffine(),aTree->Get("FacteurElargRechRaffine",1)); //tototo
}
std::string Mangling( cCibleCalib *) {return "9F9FCA1365A369B4FD3F";};
std::string & cPolygoneCalib::Name()
{
return mName;
}
const std::string & cPolygoneCalib::Name()const
{
return mName;
}
std::vector< cCibleCalib > & cPolygoneCalib::Cibles()
{
return mCibles;
}
const std::vector< cCibleCalib > & cPolygoneCalib::Cibles()const
{
return mCibles;
}
void BinaryUnDumpFromFile(cPolygoneCalib & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Name(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cCibleCalib aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Cibles().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cPolygoneCalib & anObj)
{
BinaryDumpInFile(aFp,anObj.Name());
BinaryDumpInFile(aFp,(int)anObj.Cibles().size());
for( std::vector< cCibleCalib >::const_iterator iT=anObj.Cibles().begin();
iT!=anObj.Cibles().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cPolygoneCalib & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"PolygoneCalib",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Name"),anObj.Name())->ReTagThis("Name"));
for
( std::vector< cCibleCalib >::const_iterator it=anObj.Cibles().begin();
it !=anObj.Cibles().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("Cibles"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cPolygoneCalib & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Name(),aTree->Get("Name",1)); //tototo
xml_init(anObj.Cibles(),aTree->GetAll("Cibles",false,1));
}
std::string Mangling( cPolygoneCalib *) {return "986C9723E42ABCBFFCBF";};
std::string & cPointesCibleAC::NameIm()
{
return mNameIm;
}
const std::string & cPointesCibleAC::NameIm()const
{
return mNameIm;
}
Pt2dr & cPointesCibleAC::PtIm()
{
return mPtIm;
}
const Pt2dr & cPointesCibleAC::PtIm()const
{
return mPtIm;
}
void BinaryUnDumpFromFile(cPointesCibleAC & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.NameIm(),aFp);
BinaryUnDumpFromFile(anObj.PtIm(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cPointesCibleAC & anObj)
{
BinaryDumpInFile(aFp,anObj.NameIm());
BinaryDumpInFile(aFp,anObj.PtIm());
}
cElXMLTree * ToXMLTree(const cPointesCibleAC & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"PointesCibleAC",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("NameIm"),anObj.NameIm())->ReTagThis("NameIm"));
aRes->AddFils(::ToXMLTree(std::string("PtIm"),anObj.PtIm())->ReTagThis("PtIm"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cPointesCibleAC & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameIm(),aTree->Get("NameIm",1)); //tototo
xml_init(anObj.PtIm(),aTree->Get("PtIm",1)); //tototo
}
std::string Mangling( cPointesCibleAC *) {return "4EE9EC9C8875DEF8FDBF";};
std::string & cCibleACalcByLiaisons::Name()
{
return mName;
}
const std::string & cCibleACalcByLiaisons::Name()const
{
return mName;
}
std::list< cPointesCibleAC > & cCibleACalcByLiaisons::PointesCibleAC()
{
return mPointesCibleAC;
}
const std::list< cPointesCibleAC > & cCibleACalcByLiaisons::PointesCibleAC()const
{
return mPointesCibleAC;
}
void BinaryUnDumpFromFile(cCibleACalcByLiaisons & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Name(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cPointesCibleAC aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.PointesCibleAC().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCibleACalcByLiaisons & anObj)
{
BinaryDumpInFile(aFp,anObj.Name());
BinaryDumpInFile(aFp,(int)anObj.PointesCibleAC().size());
for( std::list< cPointesCibleAC >::const_iterator iT=anObj.PointesCibleAC().begin();
iT!=anObj.PointesCibleAC().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cCibleACalcByLiaisons & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CibleACalcByLiaisons",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Name"),anObj.Name())->ReTagThis("Name"));
for
( std::list< cPointesCibleAC >::const_iterator it=anObj.PointesCibleAC().begin();
it !=anObj.PointesCibleAC().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("PointesCibleAC"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCibleACalcByLiaisons & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Name(),aTree->Get("Name",1)); //tototo
xml_init(anObj.PointesCibleAC(),aTree->GetAll("PointesCibleAC",false,1));
}
std::string Mangling( cCibleACalcByLiaisons *) {return "D004243AC6B16DA4FF3F";};
cTplValGesInit< bool > & cCible2Rech::UseIt()
{
return mUseIt;
}
const cTplValGesInit< bool > & cCible2Rech::UseIt()const
{
return mUseIt;
}
std::vector< int > & cCible2Rech::Id()
{
return mId;
}
const std::vector< int > & cCible2Rech::Id()const
{
return mId;
}
void BinaryUnDumpFromFile(cCible2Rech & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.UseIt().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.UseIt().ValForcedForUnUmp(),aFp);
}
else anObj.UseIt().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
int aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Id().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCible2Rech & anObj)
{
BinaryDumpInFile(aFp,anObj.UseIt().IsInit());
if (anObj.UseIt().IsInit()) BinaryDumpInFile(aFp,anObj.UseIt().Val());
BinaryDumpInFile(aFp,(int)anObj.Id().size());
for( std::vector< int >::const_iterator iT=anObj.Id().begin();
iT!=anObj.Id().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cCible2Rech & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"Cible2Rech",eXMLBranche);
if (anObj.UseIt().IsInit())
aRes->AddFils(::ToXMLTree(std::string("UseIt"),anObj.UseIt().Val())->ReTagThis("UseIt"));
for
( std::vector< int >::const_iterator it=anObj.Id().begin();
it !=anObj.Id().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Id"),(*it))->ReTagThis("Id"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCible2Rech & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.UseIt(),aTree->Get("UseIt",1),bool(false)); //tototo
xml_init(anObj.Id(),aTree->GetAll("Id",false,1));
}
std::string Mangling( cCible2Rech *) {return "C3018B02476EB0E0FC3F";};
cTplValGesInit< bool > & cIm2Select::UseIt()
{
return mUseIt;
}
const cTplValGesInit< bool > & cIm2Select::UseIt()const
{
return mUseIt;
}
std::vector< std::string > & cIm2Select::Id()
{
return mId;
}
const std::vector< std::string > & cIm2Select::Id()const
{
return mId;
}
void BinaryUnDumpFromFile(cIm2Select & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.UseIt().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.UseIt().ValForcedForUnUmp(),aFp);
}
else anObj.UseIt().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Id().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cIm2Select & anObj)
{
BinaryDumpInFile(aFp,anObj.UseIt().IsInit());
if (anObj.UseIt().IsInit()) BinaryDumpInFile(aFp,anObj.UseIt().Val());
BinaryDumpInFile(aFp,(int)anObj.Id().size());
for( std::vector< std::string >::const_iterator iT=anObj.Id().begin();
iT!=anObj.Id().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cIm2Select & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"Im2Select",eXMLBranche);
if (anObj.UseIt().IsInit())
aRes->AddFils(::ToXMLTree(std::string("UseIt"),anObj.UseIt().Val())->ReTagThis("UseIt"));
for
( std::vector< std::string >::const_iterator it=anObj.Id().begin();
it !=anObj.Id().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Id"),(*it))->ReTagThis("Id"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cIm2Select & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.UseIt(),aTree->Get("UseIt",1),bool(false)); //tototo
xml_init(anObj.Id(),aTree->GetAll("Id",false,1));
}
std::string Mangling( cIm2Select *) {return "AC64F3C184E67595FC3F";};
std::list< cElRegex_Ptr > & cImageUseDirectPointeManuel::Id()
{
return mId;
}
const std::list< cElRegex_Ptr > & cImageUseDirectPointeManuel::Id()const
{
return mId;
}
void BinaryUnDumpFromFile(cImageUseDirectPointeManuel & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cElRegex_Ptr aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Id().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cImageUseDirectPointeManuel & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.Id().size());
for( std::list< cElRegex_Ptr >::const_iterator iT=anObj.Id().begin();
iT!=anObj.Id().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cImageUseDirectPointeManuel & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ImageUseDirectPointeManuel",eXMLBranche);
for
( std::list< cElRegex_Ptr >::const_iterator it=anObj.Id().begin();
it !=anObj.Id().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Id"),(*it))->ReTagThis("Id"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cImageUseDirectPointeManuel & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Id(),aTree->GetAll("Id",false,1));
}
std::string Mangling( cImageUseDirectPointeManuel *) {return "84C7928A70C380A0FF3F";};
std::string & cExportAppuisAsDico::NameDico()
{
return mNameDico;
}
const std::string & cExportAppuisAsDico::NameDico()const
{
return mNameDico;
}
Pt3dr & cExportAppuisAsDico::Incertitude()
{
return mIncertitude;
}
const Pt3dr & cExportAppuisAsDico::Incertitude()const
{
return mIncertitude;
}
void BinaryUnDumpFromFile(cExportAppuisAsDico & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.NameDico(),aFp);
BinaryUnDumpFromFile(anObj.Incertitude(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cExportAppuisAsDico & anObj)
{
BinaryDumpInFile(aFp,anObj.NameDico());
BinaryDumpInFile(aFp,anObj.Incertitude());
}
cElXMLTree * ToXMLTree(const cExportAppuisAsDico & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ExportAppuisAsDico",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("NameDico"),anObj.NameDico())->ReTagThis("NameDico"));
aRes->AddFils(ToXMLTree(std::string("Incertitude"),anObj.Incertitude())->ReTagThis("Incertitude"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cExportAppuisAsDico & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameDico(),aTree->Get("NameDico",1)); //tototo
xml_init(anObj.Incertitude(),aTree->Get("Incertitude",1)); //tototo
}
std::string Mangling( cExportAppuisAsDico *) {return "F1BD9EAF3944BCEAFE3F";};
std::list< cCibleACalcByLiaisons > & cComplParamEtalPoly::CibleACalcByLiaisons()
{
return mCibleACalcByLiaisons;
}
const std::list< cCibleACalcByLiaisons > & cComplParamEtalPoly::CibleACalcByLiaisons()const
{
return mCibleACalcByLiaisons;
}
cTplValGesInit< cCible2Rech > & cComplParamEtalPoly::Cible2Rech()
{
return mCible2Rech;
}
const cTplValGesInit< cCible2Rech > & cComplParamEtalPoly::Cible2Rech()const
{
return mCible2Rech;
}
cTplValGesInit< cIm2Select > & cComplParamEtalPoly::Im2Select()
{
return mIm2Select;
}
const cTplValGesInit< cIm2Select > & cComplParamEtalPoly::Im2Select()const
{
return mIm2Select;
}
cTplValGesInit< cImageUseDirectPointeManuel > & cComplParamEtalPoly::ImageUseDirectPointeManuel()
{
return mImageUseDirectPointeManuel;
}
const cTplValGesInit< cImageUseDirectPointeManuel > & cComplParamEtalPoly::ImageUseDirectPointeManuel()const
{
return mImageUseDirectPointeManuel;
}
std::string & cComplParamEtalPoly::NameDico()
{
return ExportAppuisAsDico().Val().NameDico();
}
const std::string & cComplParamEtalPoly::NameDico()const
{
return ExportAppuisAsDico().Val().NameDico();
}
Pt3dr & cComplParamEtalPoly::Incertitude()
{
return ExportAppuisAsDico().Val().Incertitude();
}
const Pt3dr & cComplParamEtalPoly::Incertitude()const
{
return ExportAppuisAsDico().Val().Incertitude();
}
cTplValGesInit< cExportAppuisAsDico > & cComplParamEtalPoly::ExportAppuisAsDico()
{
return mExportAppuisAsDico;
}
const cTplValGesInit< cExportAppuisAsDico > & cComplParamEtalPoly::ExportAppuisAsDico()const
{
return mExportAppuisAsDico;
}
void BinaryUnDumpFromFile(cComplParamEtalPoly & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cCibleACalcByLiaisons aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.CibleACalcByLiaisons().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Cible2Rech().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Cible2Rech().ValForcedForUnUmp(),aFp);
}
else anObj.Cible2Rech().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Im2Select().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Im2Select().ValForcedForUnUmp(),aFp);
}
else anObj.Im2Select().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ImageUseDirectPointeManuel().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ImageUseDirectPointeManuel().ValForcedForUnUmp(),aFp);
}
else anObj.ImageUseDirectPointeManuel().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ExportAppuisAsDico().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ExportAppuisAsDico().ValForcedForUnUmp(),aFp);
}
else anObj.ExportAppuisAsDico().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cComplParamEtalPoly & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.CibleACalcByLiaisons().size());
for( std::list< cCibleACalcByLiaisons >::const_iterator iT=anObj.CibleACalcByLiaisons().begin();
iT!=anObj.CibleACalcByLiaisons().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.Cible2Rech().IsInit());
if (anObj.Cible2Rech().IsInit()) BinaryDumpInFile(aFp,anObj.Cible2Rech().Val());
BinaryDumpInFile(aFp,anObj.Im2Select().IsInit());
if (anObj.Im2Select().IsInit()) BinaryDumpInFile(aFp,anObj.Im2Select().Val());
BinaryDumpInFile(aFp,anObj.ImageUseDirectPointeManuel().IsInit());
if (anObj.ImageUseDirectPointeManuel().IsInit()) BinaryDumpInFile(aFp,anObj.ImageUseDirectPointeManuel().Val());
BinaryDumpInFile(aFp,anObj.ExportAppuisAsDico().IsInit());
if (anObj.ExportAppuisAsDico().IsInit()) BinaryDumpInFile(aFp,anObj.ExportAppuisAsDico().Val());
}
cElXMLTree * ToXMLTree(const cComplParamEtalPoly & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ComplParamEtalPoly",eXMLBranche);
for
( std::list< cCibleACalcByLiaisons >::const_iterator it=anObj.CibleACalcByLiaisons().begin();
it !=anObj.CibleACalcByLiaisons().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("CibleACalcByLiaisons"));
if (anObj.Cible2Rech().IsInit())
aRes->AddFils(ToXMLTree(anObj.Cible2Rech().Val())->ReTagThis("Cible2Rech"));
if (anObj.Im2Select().IsInit())
aRes->AddFils(ToXMLTree(anObj.Im2Select().Val())->ReTagThis("Im2Select"));
if (anObj.ImageUseDirectPointeManuel().IsInit())
aRes->AddFils(ToXMLTree(anObj.ImageUseDirectPointeManuel().Val())->ReTagThis("ImageUseDirectPointeManuel"));
if (anObj.ExportAppuisAsDico().IsInit())
aRes->AddFils(ToXMLTree(anObj.ExportAppuisAsDico().Val())->ReTagThis("ExportAppuisAsDico"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cComplParamEtalPoly & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.CibleACalcByLiaisons(),aTree->GetAll("CibleACalcByLiaisons",false,1));
xml_init(anObj.Cible2Rech(),aTree->Get("Cible2Rech",1)); //tototo
xml_init(anObj.Im2Select(),aTree->Get("Im2Select",1)); //tototo
xml_init(anObj.ImageUseDirectPointeManuel(),aTree->Get("ImageUseDirectPointeManuel",1)); //tototo
xml_init(anObj.ExportAppuisAsDico(),aTree->Get("ExportAppuisAsDico",1)); //tototo
}
std::string Mangling( cComplParamEtalPoly *) {return "615CC01B8368D7DEFD3F";};
Pt3dr & cOneAppuisDAF::Pt()
{
return mPt;
}
const Pt3dr & cOneAppuisDAF::Pt()const
{
return mPt;
}
std::string & cOneAppuisDAF::NamePt()
{
return mNamePt;
}
const std::string & cOneAppuisDAF::NamePt()const
{
return mNamePt;
}
Pt3dr & cOneAppuisDAF::Incertitude()
{
return mIncertitude;
}
const Pt3dr & cOneAppuisDAF::Incertitude()const
{
return mIncertitude;
}
cTplValGesInit< bool > & cOneAppuisDAF::UseForRTA()
{
return mUseForRTA;
}
const cTplValGesInit< bool > & cOneAppuisDAF::UseForRTA()const
{
return mUseForRTA;
}
cTplValGesInit< Pt3dr > & cOneAppuisDAF::Norm2Surf()
{
return mNorm2Surf;
}
const cTplValGesInit< Pt3dr > & cOneAppuisDAF::Norm2Surf()const
{
return mNorm2Surf;
}
cTplValGesInit< double > & cOneAppuisDAF::TetaN2SHor()
{
return mTetaN2SHor;
}
const cTplValGesInit< double > & cOneAppuisDAF::TetaN2SHor()const
{
return mTetaN2SHor;
}
void BinaryUnDumpFromFile(cOneAppuisDAF & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Pt(),aFp);
BinaryUnDumpFromFile(anObj.NamePt(),aFp);
BinaryUnDumpFromFile(anObj.Incertitude(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.UseForRTA().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.UseForRTA().ValForcedForUnUmp(),aFp);
}
else anObj.UseForRTA().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Norm2Surf().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Norm2Surf().ValForcedForUnUmp(),aFp);
}
else anObj.Norm2Surf().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.TetaN2SHor().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.TetaN2SHor().ValForcedForUnUmp(),aFp);
}
else anObj.TetaN2SHor().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cOneAppuisDAF & anObj)
{
BinaryDumpInFile(aFp,anObj.Pt());
BinaryDumpInFile(aFp,anObj.NamePt());
BinaryDumpInFile(aFp,anObj.Incertitude());
BinaryDumpInFile(aFp,anObj.UseForRTA().IsInit());
if (anObj.UseForRTA().IsInit()) BinaryDumpInFile(aFp,anObj.UseForRTA().Val());
BinaryDumpInFile(aFp,anObj.Norm2Surf().IsInit());
if (anObj.Norm2Surf().IsInit()) BinaryDumpInFile(aFp,anObj.Norm2Surf().Val());
BinaryDumpInFile(aFp,anObj.TetaN2SHor().IsInit());
if (anObj.TetaN2SHor().IsInit()) BinaryDumpInFile(aFp,anObj.TetaN2SHor().Val());
}
cElXMLTree * ToXMLTree(const cOneAppuisDAF & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"OneAppuisDAF",eXMLBranche);
aRes->AddFils(ToXMLTree(std::string("Pt"),anObj.Pt())->ReTagThis("Pt"));
aRes->AddFils(::ToXMLTree(std::string("NamePt"),anObj.NamePt())->ReTagThis("NamePt"));
aRes->AddFils(ToXMLTree(std::string("Incertitude"),anObj.Incertitude())->ReTagThis("Incertitude"));
if (anObj.UseForRTA().IsInit())
aRes->AddFils(::ToXMLTree(std::string("UseForRTA"),anObj.UseForRTA().Val())->ReTagThis("UseForRTA"));
if (anObj.Norm2Surf().IsInit())
aRes->AddFils(ToXMLTree(std::string("Norm2Surf"),anObj.Norm2Surf().Val())->ReTagThis("Norm2Surf"));
if (anObj.TetaN2SHor().IsInit())
aRes->AddFils(::ToXMLTree(std::string("TetaN2SHor"),anObj.TetaN2SHor().Val())->ReTagThis("TetaN2SHor"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cOneAppuisDAF & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Pt(),aTree->Get("Pt",1)); //tototo
xml_init(anObj.NamePt(),aTree->Get("NamePt",1)); //tototo
xml_init(anObj.Incertitude(),aTree->Get("Incertitude",1)); //tototo
xml_init(anObj.UseForRTA(),aTree->Get("UseForRTA",1),bool(true)); //tototo
xml_init(anObj.Norm2Surf(),aTree->Get("Norm2Surf",1)); //tototo
xml_init(anObj.TetaN2SHor(),aTree->Get("TetaN2SHor",1)); //tototo
}
std::string Mangling( cOneAppuisDAF *) {return "2FF4CBF525D2929EFF3F";};
std::list< cOneAppuisDAF > & cDicoAppuisFlottant::OneAppuisDAF()
{
return mOneAppuisDAF;
}
const std::list< cOneAppuisDAF > & cDicoAppuisFlottant::OneAppuisDAF()const
{
return mOneAppuisDAF;
}
void BinaryUnDumpFromFile(cDicoAppuisFlottant & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cOneAppuisDAF aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.OneAppuisDAF().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cDicoAppuisFlottant & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.OneAppuisDAF().size());
for( std::list< cOneAppuisDAF >::const_iterator iT=anObj.OneAppuisDAF().begin();
iT!=anObj.OneAppuisDAF().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cDicoAppuisFlottant & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"DicoAppuisFlottant",eXMLBranche);
for
( std::list< cOneAppuisDAF >::const_iterator it=anObj.OneAppuisDAF().begin();
it !=anObj.OneAppuisDAF().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("OneAppuisDAF"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cDicoAppuisFlottant & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.OneAppuisDAF(),aTree->GetAll("OneAppuisDAF",false,1));
}
std::string Mangling( cDicoAppuisFlottant *) {return "96C4234B620110DFFD3F";};
std::string & cCpleImgTime::NameIm()
{
return mNameIm;
}
const std::string & cCpleImgTime::NameIm()const
{
return mNameIm;
}
double & cCpleImgTime::TimeIm()
{
return mTimeIm;
}
const double & cCpleImgTime::TimeIm()const
{
return mTimeIm;
}
void BinaryUnDumpFromFile(cCpleImgTime & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.NameIm(),aFp);
BinaryUnDumpFromFile(anObj.TimeIm(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCpleImgTime & anObj)
{
BinaryDumpInFile(aFp,anObj.NameIm());
BinaryDumpInFile(aFp,anObj.TimeIm());
}
cElXMLTree * ToXMLTree(const cCpleImgTime & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CpleImgTime",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("NameIm"),anObj.NameIm())->ReTagThis("NameIm"));
aRes->AddFils(::ToXMLTree(std::string("TimeIm"),anObj.TimeIm())->ReTagThis("TimeIm"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCpleImgTime & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameIm(),aTree->Get("NameIm",1)); //tototo
xml_init(anObj.TimeIm(),aTree->Get("TimeIm",1)); //tototo
}
std::string Mangling( cCpleImgTime *) {return "3983A3244BD3F380FDBF";};
std::vector< cCpleImgTime > & cDicoImgsTime::CpleImgTime()
{
return mCpleImgTime;
}
const std::vector< cCpleImgTime > & cDicoImgsTime::CpleImgTime()const
{
return mCpleImgTime;
}
void BinaryUnDumpFromFile(cDicoImgsTime & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cCpleImgTime aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.CpleImgTime().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cDicoImgsTime & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.CpleImgTime().size());
for( std::vector< cCpleImgTime >::const_iterator iT=anObj.CpleImgTime().begin();
iT!=anObj.CpleImgTime().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cDicoImgsTime & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"DicoImgsTime",eXMLBranche);
for
( std::vector< cCpleImgTime >::const_iterator it=anObj.CpleImgTime().begin();
it !=anObj.CpleImgTime().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("CpleImgTime"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cDicoImgsTime & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.CpleImgTime(),aTree->GetAll("CpleImgTime",false,1));
}
std::string Mangling( cDicoImgsTime *) {return "F216D6196685EFE8FE3F";};
Pt3dr & cOneGpsDGF::Pt()
{
return mPt;
}
const Pt3dr & cOneGpsDGF::Pt()const
{
return mPt;
}
std::string & cOneGpsDGF::NamePt()
{
return mNamePt;
}
const std::string & cOneGpsDGF::NamePt()const
{
return mNamePt;
}
int & cOneGpsDGF::TagPt()
{
return mTagPt;
}
const int & cOneGpsDGF::TagPt()const
{
return mTagPt;
}
double & cOneGpsDGF::TimePt()
{
return mTimePt;
}
const double & cOneGpsDGF::TimePt()const
{
return mTimePt;
}
Pt3dr & cOneGpsDGF::Incertitude()
{
return mIncertitude;
}
const Pt3dr & cOneGpsDGF::Incertitude()const
{
return mIncertitude;
}
void BinaryUnDumpFromFile(cOneGpsDGF & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Pt(),aFp);
BinaryUnDumpFromFile(anObj.NamePt(),aFp);
BinaryUnDumpFromFile(anObj.TagPt(),aFp);
BinaryUnDumpFromFile(anObj.TimePt(),aFp);
BinaryUnDumpFromFile(anObj.Incertitude(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cOneGpsDGF & anObj)
{
BinaryDumpInFile(aFp,anObj.Pt());
BinaryDumpInFile(aFp,anObj.NamePt());
BinaryDumpInFile(aFp,anObj.TagPt());
BinaryDumpInFile(aFp,anObj.TimePt());
BinaryDumpInFile(aFp,anObj.Incertitude());
}
cElXMLTree * ToXMLTree(const cOneGpsDGF & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"OneGpsDGF",eXMLBranche);
aRes->AddFils(ToXMLTree(std::string("Pt"),anObj.Pt())->ReTagThis("Pt"));
aRes->AddFils(::ToXMLTree(std::string("NamePt"),anObj.NamePt())->ReTagThis("NamePt"));
aRes->AddFils(::ToXMLTree(std::string("TagPt"),anObj.TagPt())->ReTagThis("TagPt"));
aRes->AddFils(::ToXMLTree(std::string("TimePt"),anObj.TimePt())->ReTagThis("TimePt"));
aRes->AddFils(ToXMLTree(std::string("Incertitude"),anObj.Incertitude())->ReTagThis("Incertitude"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cOneGpsDGF & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Pt(),aTree->Get("Pt",1)); //tototo
xml_init(anObj.NamePt(),aTree->Get("NamePt",1)); //tototo
xml_init(anObj.TagPt(),aTree->Get("TagPt",1)); //tototo
xml_init(anObj.TimePt(),aTree->Get("TimePt",1)); //tototo
xml_init(anObj.Incertitude(),aTree->Get("Incertitude",1)); //tototo
}
std::string Mangling( cOneGpsDGF *) {return "20235A6E7B4562C4F93F";};
std::vector< cOneGpsDGF > & cDicoGpsFlottant::OneGpsDGF()
{
return mOneGpsDGF;
}
const std::vector< cOneGpsDGF > & cDicoGpsFlottant::OneGpsDGF()const
{
return mOneGpsDGF;
}
void BinaryUnDumpFromFile(cDicoGpsFlottant & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cOneGpsDGF aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.OneGpsDGF().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cDicoGpsFlottant & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.OneGpsDGF().size());
for( std::vector< cOneGpsDGF >::const_iterator iT=anObj.OneGpsDGF().begin();
iT!=anObj.OneGpsDGF().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cDicoGpsFlottant & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"DicoGpsFlottant",eXMLBranche);
for
( std::vector< cOneGpsDGF >::const_iterator it=anObj.OneGpsDGF().begin();
it !=anObj.OneGpsDGF().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("OneGpsDGF"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cDicoGpsFlottant & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.OneGpsDGF(),aTree->GetAll("OneGpsDGF",false,1));
}
std::string Mangling( cDicoGpsFlottant *) {return "AA5686ABDAE3EFE7FE3F";};
std::string & cOneModifIPF::KeyName()
{
return mKeyName;
}
const std::string & cOneModifIPF::KeyName()const
{
return mKeyName;
}
Pt3dr & cOneModifIPF::Incertitude()
{
return mIncertitude;
}
const Pt3dr & cOneModifIPF::Incertitude()const
{
return mIncertitude;
}
cTplValGesInit< bool > & cOneModifIPF::IsMult()
{
return mIsMult;
}
const cTplValGesInit< bool > & cOneModifIPF::IsMult()const
{
return mIsMult;
}
void BinaryUnDumpFromFile(cOneModifIPF & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.KeyName(),aFp);
BinaryUnDumpFromFile(anObj.Incertitude(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.IsMult().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.IsMult().ValForcedForUnUmp(),aFp);
}
else anObj.IsMult().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cOneModifIPF & anObj)
{
BinaryDumpInFile(aFp,anObj.KeyName());
BinaryDumpInFile(aFp,anObj.Incertitude());
BinaryDumpInFile(aFp,anObj.IsMult().IsInit());
if (anObj.IsMult().IsInit()) BinaryDumpInFile(aFp,anObj.IsMult().Val());
}
cElXMLTree * ToXMLTree(const cOneModifIPF & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"OneModifIPF",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("KeyName"),anObj.KeyName())->ReTagThis("KeyName"));
aRes->AddFils(ToXMLTree(std::string("Incertitude"),anObj.Incertitude())->ReTagThis("Incertitude"));
if (anObj.IsMult().IsInit())
aRes->AddFils(::ToXMLTree(std::string("IsMult"),anObj.IsMult().Val())->ReTagThis("IsMult"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cOneModifIPF & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeyName(),aTree->Get("KeyName",1)); //tototo
xml_init(anObj.Incertitude(),aTree->Get("Incertitude",1)); //tototo
xml_init(anObj.IsMult(),aTree->Get("IsMult",1),bool(false)); //tototo
}
std::string Mangling( cOneModifIPF *) {return "99C991645C264193FF3F";};
std::list< cOneModifIPF > & cModifIncPtsFlottant::OneModifIPF()
{
return mOneModifIPF;
}
const std::list< cOneModifIPF > & cModifIncPtsFlottant::OneModifIPF()const
{
return mOneModifIPF;
}
void BinaryUnDumpFromFile(cModifIncPtsFlottant & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cOneModifIPF aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.OneModifIPF().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cModifIncPtsFlottant & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.OneModifIPF().size());
for( std::list< cOneModifIPF >::const_iterator iT=anObj.OneModifIPF().begin();
iT!=anObj.OneModifIPF().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cModifIncPtsFlottant & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ModifIncPtsFlottant",eXMLBranche);
for
( std::list< cOneModifIPF >::const_iterator it=anObj.OneModifIPF().begin();
it !=anObj.OneModifIPF().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("OneModifIPF"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cModifIncPtsFlottant & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.OneModifIPF(),aTree->GetAll("OneModifIPF",false,1));
}
std::string Mangling( cModifIncPtsFlottant *) {return "2690A7453F107480FD3F";};
cTplValGesInit< double > & cOneMesureAF1I::PrecPointe()
{
return mPrecPointe;
}
const cTplValGesInit< double > & cOneMesureAF1I::PrecPointe()const
{
return mPrecPointe;
}
std::string & cOneMesureAF1I::NamePt()
{
return mNamePt;
}
const std::string & cOneMesureAF1I::NamePt()const
{
return mNamePt;
}
Pt2dr & cOneMesureAF1I::PtIm()
{
return mPtIm;
}
const Pt2dr & cOneMesureAF1I::PtIm()const
{
return mPtIm;
}
void BinaryUnDumpFromFile(cOneMesureAF1I & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.PrecPointe().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.PrecPointe().ValForcedForUnUmp(),aFp);
}
else anObj.PrecPointe().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.NamePt(),aFp);
BinaryUnDumpFromFile(anObj.PtIm(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cOneMesureAF1I & anObj)
{
BinaryDumpInFile(aFp,anObj.PrecPointe().IsInit());
if (anObj.PrecPointe().IsInit()) BinaryDumpInFile(aFp,anObj.PrecPointe().Val());
BinaryDumpInFile(aFp,anObj.NamePt());
BinaryDumpInFile(aFp,anObj.PtIm());
}
cElXMLTree * ToXMLTree(const cOneMesureAF1I & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"OneMesureAF1I",eXMLBranche);
if (anObj.PrecPointe().IsInit())
aRes->AddFils(::ToXMLTree(std::string("PrecPointe"),anObj.PrecPointe().Val())->ReTagThis("PrecPointe"));
aRes->AddFils(::ToXMLTree(std::string("NamePt"),anObj.NamePt())->ReTagThis("NamePt"));
aRes->AddFils(::ToXMLTree(std::string("PtIm"),anObj.PtIm())->ReTagThis("PtIm"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cOneMesureAF1I & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.PrecPointe(),aTree->Get("PrecPointe",1)); //tototo
xml_init(anObj.NamePt(),aTree->Get("NamePt",1)); //tototo
xml_init(anObj.PtIm(),aTree->Get("PtIm",1)); //tototo
}
std::string Mangling( cOneMesureAF1I *) {return "D8A76302F738DCF6FBBF";};
std::string & cMesureAppuiFlottant1Im::NameIm()
{
return mNameIm;
}
const std::string & cMesureAppuiFlottant1Im::NameIm()const
{
return mNameIm;
}
cTplValGesInit< double > & cMesureAppuiFlottant1Im::PrecPointeByIm()
{
return mPrecPointeByIm;
}
const cTplValGesInit< double > & cMesureAppuiFlottant1Im::PrecPointeByIm()const
{
return mPrecPointeByIm;
}
std::list< cOneMesureAF1I > & cMesureAppuiFlottant1Im::OneMesureAF1I()
{
return mOneMesureAF1I;
}
const std::list< cOneMesureAF1I > & cMesureAppuiFlottant1Im::OneMesureAF1I()const
{
return mOneMesureAF1I;
}
void BinaryUnDumpFromFile(cMesureAppuiFlottant1Im & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.NameIm(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.PrecPointeByIm().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.PrecPointeByIm().ValForcedForUnUmp(),aFp);
}
else anObj.PrecPointeByIm().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cOneMesureAF1I aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.OneMesureAF1I().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cMesureAppuiFlottant1Im & anObj)
{
BinaryDumpInFile(aFp,anObj.NameIm());
BinaryDumpInFile(aFp,anObj.PrecPointeByIm().IsInit());
if (anObj.PrecPointeByIm().IsInit()) BinaryDumpInFile(aFp,anObj.PrecPointeByIm().Val());
BinaryDumpInFile(aFp,(int)anObj.OneMesureAF1I().size());
for( std::list< cOneMesureAF1I >::const_iterator iT=anObj.OneMesureAF1I().begin();
iT!=anObj.OneMesureAF1I().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cMesureAppuiFlottant1Im & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"MesureAppuiFlottant1Im",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("NameIm"),anObj.NameIm())->ReTagThis("NameIm"));
if (anObj.PrecPointeByIm().IsInit())
aRes->AddFils(::ToXMLTree(std::string("PrecPointeByIm"),anObj.PrecPointeByIm().Val())->ReTagThis("PrecPointeByIm"));
for
( std::list< cOneMesureAF1I >::const_iterator it=anObj.OneMesureAF1I().begin();
it !=anObj.OneMesureAF1I().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("OneMesureAF1I"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cMesureAppuiFlottant1Im & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameIm(),aTree->Get("NameIm",1)); //tototo
xml_init(anObj.PrecPointeByIm(),aTree->Get("PrecPointeByIm",1)); //tototo
xml_init(anObj.OneMesureAF1I(),aTree->GetAll("OneMesureAF1I",false,1));
}
std::string Mangling( cMesureAppuiFlottant1Im *) {return "1CC3D7D51E47AFF1FE3F";};
std::list< cMesureAppuiFlottant1Im > & cSetOfMesureAppuisFlottants::MesureAppuiFlottant1Im()
{
return mMesureAppuiFlottant1Im;
}
const std::list< cMesureAppuiFlottant1Im > & cSetOfMesureAppuisFlottants::MesureAppuiFlottant1Im()const
{
return mMesureAppuiFlottant1Im;
}
void BinaryUnDumpFromFile(cSetOfMesureAppuisFlottants & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cMesureAppuiFlottant1Im aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.MesureAppuiFlottant1Im().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cSetOfMesureAppuisFlottants & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.MesureAppuiFlottant1Im().size());
for( std::list< cMesureAppuiFlottant1Im >::const_iterator iT=anObj.MesureAppuiFlottant1Im().begin();
iT!=anObj.MesureAppuiFlottant1Im().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cSetOfMesureAppuisFlottants & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"SetOfMesureAppuisFlottants",eXMLBranche);
for
( std::list< cMesureAppuiFlottant1Im >::const_iterator it=anObj.MesureAppuiFlottant1Im().begin();
it !=anObj.MesureAppuiFlottant1Im().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("MesureAppuiFlottant1Im"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cSetOfMesureAppuisFlottants & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.MesureAppuiFlottant1Im(),aTree->GetAll("MesureAppuiFlottant1Im",false,1));
}
std::string Mangling( cSetOfMesureAppuisFlottants *) {return "414028A06C25BE9FFF3F";};
std::list< std::string > & cOneMesureSegDr::NamePt()
{
return mNamePt;
}
const std::list< std::string > & cOneMesureSegDr::NamePt()const
{
return mNamePt;
}
Pt2dr & cOneMesureSegDr::Pt1Im()
{
return mPt1Im;
}
const Pt2dr & cOneMesureSegDr::Pt1Im()const
{
return mPt1Im;
}
Pt2dr & cOneMesureSegDr::Pt2Im()
{
return mPt2Im;
}
const Pt2dr & cOneMesureSegDr::Pt2Im()const
{
return mPt2Im;
}
void BinaryUnDumpFromFile(cOneMesureSegDr & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.NamePt().push_back(aVal);
}
} ;
BinaryUnDumpFromFile(anObj.Pt1Im(),aFp);
BinaryUnDumpFromFile(anObj.Pt2Im(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cOneMesureSegDr & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.NamePt().size());
for( std::list< std::string >::const_iterator iT=anObj.NamePt().begin();
iT!=anObj.NamePt().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.Pt1Im());
BinaryDumpInFile(aFp,anObj.Pt2Im());
}
cElXMLTree * ToXMLTree(const cOneMesureSegDr & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"OneMesureSegDr",eXMLBranche);
for
( std::list< std::string >::const_iterator it=anObj.NamePt().begin();
it !=anObj.NamePt().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("NamePt"),(*it))->ReTagThis("NamePt"));
aRes->AddFils(::ToXMLTree(std::string("Pt1Im"),anObj.Pt1Im())->ReTagThis("Pt1Im"));
aRes->AddFils(::ToXMLTree(std::string("Pt2Im"),anObj.Pt2Im())->ReTagThis("Pt2Im"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cOneMesureSegDr & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NamePt(),aTree->GetAll("NamePt",false,1));
xml_init(anObj.Pt1Im(),aTree->Get("Pt1Im",1)); //tototo
xml_init(anObj.Pt2Im(),aTree->Get("Pt2Im",1)); //tototo
}
std::string Mangling( cOneMesureSegDr *) {return "0264FFB51727F087FF3F";};
std::string & cMesureAppuiSegDr1Im::NameIm()
{
return mNameIm;
}
const std::string & cMesureAppuiSegDr1Im::NameIm()const
{
return mNameIm;
}
std::list< cOneMesureSegDr > & cMesureAppuiSegDr1Im::OneMesureSegDr()
{
return mOneMesureSegDr;
}
const std::list< cOneMesureSegDr > & cMesureAppuiSegDr1Im::OneMesureSegDr()const
{
return mOneMesureSegDr;
}
void BinaryUnDumpFromFile(cMesureAppuiSegDr1Im & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.NameIm(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cOneMesureSegDr aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.OneMesureSegDr().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cMesureAppuiSegDr1Im & anObj)
{
BinaryDumpInFile(aFp,anObj.NameIm());
BinaryDumpInFile(aFp,(int)anObj.OneMesureSegDr().size());
for( std::list< cOneMesureSegDr >::const_iterator iT=anObj.OneMesureSegDr().begin();
iT!=anObj.OneMesureSegDr().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cMesureAppuiSegDr1Im & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"MesureAppuiSegDr1Im",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("NameIm"),anObj.NameIm())->ReTagThis("NameIm"));
for
( std::list< cOneMesureSegDr >::const_iterator it=anObj.OneMesureSegDr().begin();
it !=anObj.OneMesureSegDr().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("OneMesureSegDr"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cMesureAppuiSegDr1Im & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameIm(),aTree->Get("NameIm",1)); //tototo
xml_init(anObj.OneMesureSegDr(),aTree->GetAll("OneMesureSegDr",false,1));
}
std::string Mangling( cMesureAppuiSegDr1Im *) {return "68E529CDB22B3FA3FF3F";};
std::list< cMesureAppuiSegDr1Im > & cSetOfMesureSegDr::MesureAppuiSegDr1Im()
{
return mMesureAppuiSegDr1Im;
}
const std::list< cMesureAppuiSegDr1Im > & cSetOfMesureSegDr::MesureAppuiSegDr1Im()const
{
return mMesureAppuiSegDr1Im;
}
void BinaryUnDumpFromFile(cSetOfMesureSegDr & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cMesureAppuiSegDr1Im aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.MesureAppuiSegDr1Im().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cSetOfMesureSegDr & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.MesureAppuiSegDr1Im().size());
for( std::list< cMesureAppuiSegDr1Im >::const_iterator iT=anObj.MesureAppuiSegDr1Im().begin();
iT!=anObj.MesureAppuiSegDr1Im().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cSetOfMesureSegDr & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"SetOfMesureSegDr",eXMLBranche);
for
( std::list< cMesureAppuiSegDr1Im >::const_iterator it=anObj.MesureAppuiSegDr1Im().begin();
it !=anObj.MesureAppuiSegDr1Im().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("MesureAppuiSegDr1Im"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cSetOfMesureSegDr & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.MesureAppuiSegDr1Im(),aTree->GetAll("MesureAppuiSegDr1Im",false,1));
}
std::string Mangling( cSetOfMesureSegDr *) {return "C88F586AD97841E5FBBF";};
cTplValGesInit< int > & cMesureAppuis::Num()
{
return mNum;
}
const cTplValGesInit< int > & cMesureAppuis::Num()const
{
return mNum;
}
Pt2dr & cMesureAppuis::Im()
{
return mIm;
}
const Pt2dr & cMesureAppuis::Im()const
{
return mIm;
}
Pt3dr & cMesureAppuis::Ter()
{
return mTer;
}
const Pt3dr & cMesureAppuis::Ter()const
{
return mTer;
}
void BinaryUnDumpFromFile(cMesureAppuis & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Num().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Num().ValForcedForUnUmp(),aFp);
}
else anObj.Num().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.Im(),aFp);
BinaryUnDumpFromFile(anObj.Ter(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cMesureAppuis & anObj)
{
BinaryDumpInFile(aFp,anObj.Num().IsInit());
if (anObj.Num().IsInit()) BinaryDumpInFile(aFp,anObj.Num().Val());
BinaryDumpInFile(aFp,anObj.Im());
BinaryDumpInFile(aFp,anObj.Ter());
}
cElXMLTree * ToXMLTree(const cMesureAppuis & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"MesureAppuis",eXMLBranche);
if (anObj.Num().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Num"),anObj.Num().Val())->ReTagThis("Num"));
aRes->AddFils(::ToXMLTree(std::string("Im"),anObj.Im())->ReTagThis("Im"));
aRes->AddFils(ToXMLTree(std::string("Ter"),anObj.Ter())->ReTagThis("Ter"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cMesureAppuis & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Num(),aTree->Get("Num",1)); //tototo
xml_init(anObj.Im(),aTree->Get("Im",1)); //tototo
xml_init(anObj.Ter(),aTree->Get("Ter",1)); //tototo
}
std::string Mangling( cMesureAppuis *) {return "CF40CF2C303271D2FF3F";};
cTplValGesInit< std::string > & cListeAppuis1Im::NameImage()
{
return mNameImage;
}
const cTplValGesInit< std::string > & cListeAppuis1Im::NameImage()const
{
return mNameImage;
}
std::list< cMesureAppuis > & cListeAppuis1Im::Mesures()
{
return mMesures;
}
const std::list< cMesureAppuis > & cListeAppuis1Im::Mesures()const
{
return mMesures;
}
void BinaryUnDumpFromFile(cListeAppuis1Im & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NameImage().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NameImage().ValForcedForUnUmp(),aFp);
}
else anObj.NameImage().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cMesureAppuis aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Mesures().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cListeAppuis1Im & anObj)
{
BinaryDumpInFile(aFp,anObj.NameImage().IsInit());
if (anObj.NameImage().IsInit()) BinaryDumpInFile(aFp,anObj.NameImage().Val());
BinaryDumpInFile(aFp,(int)anObj.Mesures().size());
for( std::list< cMesureAppuis >::const_iterator iT=anObj.Mesures().begin();
iT!=anObj.Mesures().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cListeAppuis1Im & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ListeAppuis1Im",eXMLBranche);
if (anObj.NameImage().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NameImage"),anObj.NameImage().Val())->ReTagThis("NameImage"));
for
( std::list< cMesureAppuis >::const_iterator it=anObj.Mesures().begin();
it !=anObj.Mesures().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("Mesures"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cListeAppuis1Im & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameImage(),aTree->Get("NameImage",1),std::string("NoName")); //tototo
xml_init(anObj.Mesures(),aTree->GetAll("Mesures",false,1));
}
std::string Mangling( cListeAppuis1Im *) {return "4BE7FA0B90B52DA9FD3F";};
double & cVerifOrient::Tol()
{
return mTol;
}
const double & cVerifOrient::Tol()const
{
return mTol;
}
cTplValGesInit< bool > & cVerifOrient::ShowMes()
{
return mShowMes;
}
const cTplValGesInit< bool > & cVerifOrient::ShowMes()const
{
return mShowMes;
}
std::list< cMesureAppuis > & cVerifOrient::Appuis()
{
return mAppuis;
}
const std::list< cMesureAppuis > & cVerifOrient::Appuis()const
{
return mAppuis;
}
cTplValGesInit< bool > & cVerifOrient::IsTest()
{
return mIsTest;
}
const cTplValGesInit< bool > & cVerifOrient::IsTest()const
{
return mIsTest;
}
cTplValGesInit< cListeAppuis1Im > & cVerifOrient::AppuisConv()
{
return mAppuisConv;
}
const cTplValGesInit< cListeAppuis1Im > & cVerifOrient::AppuisConv()const
{
return mAppuisConv;
}
void BinaryUnDumpFromFile(cVerifOrient & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Tol(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ShowMes().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ShowMes().ValForcedForUnUmp(),aFp);
}
else anObj.ShowMes().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cMesureAppuis aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Appuis().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.IsTest().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.IsTest().ValForcedForUnUmp(),aFp);
}
else anObj.IsTest().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.AppuisConv().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.AppuisConv().ValForcedForUnUmp(),aFp);
}
else anObj.AppuisConv().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cVerifOrient & anObj)
{
BinaryDumpInFile(aFp,anObj.Tol());
BinaryDumpInFile(aFp,anObj.ShowMes().IsInit());
if (anObj.ShowMes().IsInit()) BinaryDumpInFile(aFp,anObj.ShowMes().Val());
BinaryDumpInFile(aFp,(int)anObj.Appuis().size());
for( std::list< cMesureAppuis >::const_iterator iT=anObj.Appuis().begin();
iT!=anObj.Appuis().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.IsTest().IsInit());
if (anObj.IsTest().IsInit()) BinaryDumpInFile(aFp,anObj.IsTest().Val());
BinaryDumpInFile(aFp,anObj.AppuisConv().IsInit());
if (anObj.AppuisConv().IsInit()) BinaryDumpInFile(aFp,anObj.AppuisConv().Val());
}
cElXMLTree * ToXMLTree(const cVerifOrient & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"VerifOrient",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Tol"),anObj.Tol())->ReTagThis("Tol"));
if (anObj.ShowMes().IsInit())
aRes->AddFils(::ToXMLTree(std::string("ShowMes"),anObj.ShowMes().Val())->ReTagThis("ShowMes"));
for
( std::list< cMesureAppuis >::const_iterator it=anObj.Appuis().begin();
it !=anObj.Appuis().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("Appuis"));
if (anObj.IsTest().IsInit())
aRes->AddFils(::ToXMLTree(std::string("IsTest"),anObj.IsTest().Val())->ReTagThis("IsTest"));
if (anObj.AppuisConv().IsInit())
aRes->AddFils(ToXMLTree(anObj.AppuisConv().Val())->ReTagThis("AppuisConv"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cVerifOrient & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Tol(),aTree->Get("Tol",1)); //tototo
xml_init(anObj.ShowMes(),aTree->Get("ShowMes",1),bool(false)); //tototo
xml_init(anObj.Appuis(),aTree->GetAll("Appuis",false,1));
xml_init(anObj.IsTest(),aTree->Get("IsTest",1),bool(false)); //tototo
xml_init(anObj.AppuisConv(),aTree->Get("AppuisConv",1)); //tototo
}
std::string Mangling( cVerifOrient *) {return "D232494E2900D8FAFE3F";};
eConventionsOrientation Str2eConventionsOrientation(const std::string & aName)
{
if (aName=="eConvInconnue")
return eConvInconnue;
else if (aName=="eConvApero_DistC2M")
return eConvApero_DistC2M;
else if (aName=="eConvApero_DistM2C")
return eConvApero_DistM2C;
else if (aName=="eConvOriLib")
return eConvOriLib;
else if (aName=="eConvMatrPoivillier_E")
return eConvMatrPoivillier_E;
else if (aName=="eConvAngErdas")
return eConvAngErdas;
else if (aName=="eConvAngErdas_Grade")
return eConvAngErdas_Grade;
else if (aName=="eConvAngAvionJaune")
return eConvAngAvionJaune;
else if (aName=="eConvAngSurvey")
return eConvAngSurvey;
else if (aName=="eConvAngPhotoMDegre")
return eConvAngPhotoMDegre;
else if (aName=="eConvAngPhotoMGrade")
return eConvAngPhotoMGrade;
else if (aName=="eConvAngLPSDegre")
return eConvAngLPSDegre;
else if (aName=="eConvMatrixInpho")
return eConvMatrixInpho;
else
{
cout << aName << " is not a correct value for enum eConventionsOrientation\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eConventionsOrientation) 0;
}
void xml_init(eConventionsOrientation & aVal,cElXMLTree * aTree)
{
aVal= Str2eConventionsOrientation(aTree->Contenu());
}
std::string eToString(const eConventionsOrientation & anObj)
{
if (anObj==eConvInconnue)
return "eConvInconnue";
if (anObj==eConvApero_DistC2M)
return "eConvApero_DistC2M";
if (anObj==eConvApero_DistM2C)
return "eConvApero_DistM2C";
if (anObj==eConvOriLib)
return "eConvOriLib";
if (anObj==eConvMatrPoivillier_E)
return "eConvMatrPoivillier_E";
if (anObj==eConvAngErdas)
return "eConvAngErdas";
if (anObj==eConvAngErdas_Grade)
return "eConvAngErdas_Grade";
if (anObj==eConvAngAvionJaune)
return "eConvAngAvionJaune";
if (anObj==eConvAngSurvey)
return "eConvAngSurvey";
if (anObj==eConvAngPhotoMDegre)
return "eConvAngPhotoMDegre";
if (anObj==eConvAngPhotoMGrade)
return "eConvAngPhotoMGrade";
if (anObj==eConvAngLPSDegre)
return "eConvAngLPSDegre";
if (anObj==eConvMatrixInpho)
return "eConvMatrixInpho";
std::cout << "Enum = eConventionsOrientation\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eConventionsOrientation & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eConventionsOrientation & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eConventionsOrientation & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eConventionsOrientation) aIVal;
}
std::string Mangling( eConventionsOrientation *) {return "D45887C8F44ACDAFFC3F";};
eExportOri Str2eExportOri(const std::string & aName)
{
if (aName=="eEO_MMM")
return eEO_MMM;
else if (aName=="eEO_AMM")
return eEO_AMM;
else if (aName=="eEO_WPK")
return eEO_WPK;
else if (aName=="eEO_NbVals")
return eEO_NbVals;
else
{
cout << aName << " is not a correct value for enum eExportOri\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eExportOri) 0;
}
void xml_init(eExportOri & aVal,cElXMLTree * aTree)
{
aVal= Str2eExportOri(aTree->Contenu());
}
std::string eToString(const eExportOri & anObj)
{
if (anObj==eEO_MMM)
return "eEO_MMM";
if (anObj==eEO_AMM)
return "eEO_AMM";
if (anObj==eEO_WPK)
return "eEO_WPK";
if (anObj==eEO_NbVals)
return "eEO_NbVals";
std::cout << "Enum = eExportOri\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eExportOri & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eExportOri & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eExportOri & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eExportOri) aIVal;
}
std::string Mangling( eExportOri *) {return "36AFC96E5EDC34C0FE3F";};
std::string & cJPPTest::Name()
{
return mName;
}
const std::string & cJPPTest::Name()const
{
return mName;
}
std::list< int > & cJPPTest::LN()
{
return mLN;
}
const std::list< int > & cJPPTest::LN()const
{
return mLN;
}
void BinaryUnDumpFromFile(cJPPTest & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Name(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
int aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.LN().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cJPPTest & anObj)
{
BinaryDumpInFile(aFp,anObj.Name());
BinaryDumpInFile(aFp,(int)anObj.LN().size());
for( std::list< int >::const_iterator iT=anObj.LN().begin();
iT!=anObj.LN().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cJPPTest & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"JPPTest",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Name"),anObj.Name())->ReTagThis("Name"));
for
( std::list< int >::const_iterator it=anObj.LN().begin();
it !=anObj.LN().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("LN"),(*it))->ReTagThis("LN"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cJPPTest & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Name(),aTree->Get("Name",1)); //tototo
xml_init(anObj.LN(),aTree->GetAll("LN",false,1));
}
std::string Mangling( cJPPTest *) {return "9E0D62C956BC88F2FDBF";};
Pt2dr & cCalibrationInterneGridDef::P0()
{
return mP0;
}
const Pt2dr & cCalibrationInterneGridDef::P0()const
{
return mP0;
}
Pt2dr & cCalibrationInterneGridDef::P1()
{
return mP1;
}
const Pt2dr & cCalibrationInterneGridDef::P1()const
{
return mP1;
}
Pt2di & cCalibrationInterneGridDef::Nb()
{
return mNb;
}
const Pt2di & cCalibrationInterneGridDef::Nb()const
{
return mNb;
}
std::vector< Pt2dr > & cCalibrationInterneGridDef::PGr()
{
return mPGr;
}
const std::vector< Pt2dr > & cCalibrationInterneGridDef::PGr()const
{
return mPGr;
}
void BinaryUnDumpFromFile(cCalibrationInterneGridDef & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.P0(),aFp);
BinaryUnDumpFromFile(anObj.P1(),aFp);
BinaryUnDumpFromFile(anObj.Nb(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
Pt2dr aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.PGr().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCalibrationInterneGridDef & anObj)
{
BinaryDumpInFile(aFp,anObj.P0());
BinaryDumpInFile(aFp,anObj.P1());
BinaryDumpInFile(aFp,anObj.Nb());
BinaryDumpInFile(aFp,(int)anObj.PGr().size());
for( std::vector< Pt2dr >::const_iterator iT=anObj.PGr().begin();
iT!=anObj.PGr().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cCalibrationInterneGridDef & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CalibrationInterneGridDef",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("P0"),anObj.P0())->ReTagThis("P0"));
aRes->AddFils(::ToXMLTree(std::string("P1"),anObj.P1())->ReTagThis("P1"));
aRes->AddFils(::ToXMLTree(std::string("Nb"),anObj.Nb())->ReTagThis("Nb"));
for
( std::vector< Pt2dr >::const_iterator it=anObj.PGr().begin();
it !=anObj.PGr().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("PGr"),(*it))->ReTagThis("PGr"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCalibrationInterneGridDef & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.P0(),aTree->Get("P0",1)); //tototo
xml_init(anObj.P1(),aTree->Get("P1",1)); //tototo
xml_init(anObj.Nb(),aTree->Get("Nb",1)); //tototo
xml_init(anObj.PGr(),aTree->GetAll("PGr",false,1));
}
std::string Mangling( cCalibrationInterneGridDef *) {return "103FDE5D91381085FF3F";};
Pt2dr & cCalibrationInterneRadiale::CDist()
{
return mCDist;
}
const Pt2dr & cCalibrationInterneRadiale::CDist()const
{
return mCDist;
}
std::vector< double > & cCalibrationInterneRadiale::CoeffDist()
{
return mCoeffDist;
}
const std::vector< double > & cCalibrationInterneRadiale::CoeffDist()const
{
return mCoeffDist;
}
std::vector< double > & cCalibrationInterneRadiale::CoeffDistInv()
{
return mCoeffDistInv;
}
const std::vector< double > & cCalibrationInterneRadiale::CoeffDistInv()const
{
return mCoeffDistInv;
}
cTplValGesInit< double > & cCalibrationInterneRadiale::RatioDistInv()
{
return mRatioDistInv;
}
const cTplValGesInit< double > & cCalibrationInterneRadiale::RatioDistInv()const
{
return mRatioDistInv;
}
cTplValGesInit< bool > & cCalibrationInterneRadiale::PPaEqPPs()
{
return mPPaEqPPs;
}
const cTplValGesInit< bool > & cCalibrationInterneRadiale::PPaEqPPs()const
{
return mPPaEqPPs;
}
void BinaryUnDumpFromFile(cCalibrationInterneRadiale & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.CDist(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
double aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.CoeffDist().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
double aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.CoeffDistInv().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.RatioDistInv().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.RatioDistInv().ValForcedForUnUmp(),aFp);
}
else anObj.RatioDistInv().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.PPaEqPPs().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.PPaEqPPs().ValForcedForUnUmp(),aFp);
}
else anObj.PPaEqPPs().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCalibrationInterneRadiale & anObj)
{
BinaryDumpInFile(aFp,anObj.CDist());
BinaryDumpInFile(aFp,(int)anObj.CoeffDist().size());
for( std::vector< double >::const_iterator iT=anObj.CoeffDist().begin();
iT!=anObj.CoeffDist().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.CoeffDistInv().size());
for( std::vector< double >::const_iterator iT=anObj.CoeffDistInv().begin();
iT!=anObj.CoeffDistInv().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.RatioDistInv().IsInit());
if (anObj.RatioDistInv().IsInit()) BinaryDumpInFile(aFp,anObj.RatioDistInv().Val());
BinaryDumpInFile(aFp,anObj.PPaEqPPs().IsInit());
if (anObj.PPaEqPPs().IsInit()) BinaryDumpInFile(aFp,anObj.PPaEqPPs().Val());
}
cElXMLTree * ToXMLTree(const cCalibrationInterneRadiale & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CalibrationInterneRadiale",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("CDist"),anObj.CDist())->ReTagThis("CDist"));
for
( std::vector< double >::const_iterator it=anObj.CoeffDist().begin();
it !=anObj.CoeffDist().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("CoeffDist"),(*it))->ReTagThis("CoeffDist"));
for
( std::vector< double >::const_iterator it=anObj.CoeffDistInv().begin();
it !=anObj.CoeffDistInv().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("CoeffDistInv"),(*it))->ReTagThis("CoeffDistInv"));
if (anObj.RatioDistInv().IsInit())
aRes->AddFils(::ToXMLTree(std::string("RatioDistInv"),anObj.RatioDistInv().Val())->ReTagThis("RatioDistInv"));
if (anObj.PPaEqPPs().IsInit())
aRes->AddFils(::ToXMLTree(std::string("PPaEqPPs"),anObj.PPaEqPPs().Val())->ReTagThis("PPaEqPPs"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCalibrationInterneRadiale & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.CDist(),aTree->Get("CDist",1)); //tototo
xml_init(anObj.CoeffDist(),aTree->GetAll("CoeffDist",false,1));
xml_init(anObj.CoeffDistInv(),aTree->GetAll("CoeffDistInv",false,1));
xml_init(anObj.RatioDistInv(),aTree->Get("RatioDistInv",1),double(1.3)); //tototo
xml_init(anObj.PPaEqPPs(),aTree->Get("PPaEqPPs",1),bool(false)); //tototo
}
std::string Mangling( cCalibrationInterneRadiale *) {return "8D43B326A0D4AE82FF3F";};
cCalibrationInterneRadiale & cCalibrationInternePghrStd::RadialePart()
{
return mRadialePart;
}
const cCalibrationInterneRadiale & cCalibrationInternePghrStd::RadialePart()const
{
return mRadialePart;
}
cTplValGesInit< double > & cCalibrationInternePghrStd::P1()
{
return mP1;
}
const cTplValGesInit< double > & cCalibrationInternePghrStd::P1()const
{
return mP1;
}
cTplValGesInit< double > & cCalibrationInternePghrStd::P2()
{
return mP2;
}
const cTplValGesInit< double > & cCalibrationInternePghrStd::P2()const
{
return mP2;
}
cTplValGesInit< double > & cCalibrationInternePghrStd::b1()
{
return mb1;
}
const cTplValGesInit< double > & cCalibrationInternePghrStd::b1()const
{
return mb1;
}
cTplValGesInit< double > & cCalibrationInternePghrStd::b2()
{
return mb2;
}
const cTplValGesInit< double > & cCalibrationInternePghrStd::b2()const
{
return mb2;
}
void BinaryUnDumpFromFile(cCalibrationInternePghrStd & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.RadialePart(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.P1().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.P1().ValForcedForUnUmp(),aFp);
}
else anObj.P1().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.P2().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.P2().ValForcedForUnUmp(),aFp);
}
else anObj.P2().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.b1().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.b1().ValForcedForUnUmp(),aFp);
}
else anObj.b1().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.b2().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.b2().ValForcedForUnUmp(),aFp);
}
else anObj.b2().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCalibrationInternePghrStd & anObj)
{
BinaryDumpInFile(aFp,anObj.RadialePart());
BinaryDumpInFile(aFp,anObj.P1().IsInit());
if (anObj.P1().IsInit()) BinaryDumpInFile(aFp,anObj.P1().Val());
BinaryDumpInFile(aFp,anObj.P2().IsInit());
if (anObj.P2().IsInit()) BinaryDumpInFile(aFp,anObj.P2().Val());
BinaryDumpInFile(aFp,anObj.b1().IsInit());
if (anObj.b1().IsInit()) BinaryDumpInFile(aFp,anObj.b1().Val());
BinaryDumpInFile(aFp,anObj.b2().IsInit());
if (anObj.b2().IsInit()) BinaryDumpInFile(aFp,anObj.b2().Val());
}
cElXMLTree * ToXMLTree(const cCalibrationInternePghrStd & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CalibrationInternePghrStd",eXMLBranche);
aRes->AddFils(ToXMLTree(anObj.RadialePart())->ReTagThis("RadialePart"));
if (anObj.P1().IsInit())
aRes->AddFils(::ToXMLTree(std::string("P1"),anObj.P1().Val())->ReTagThis("P1"));
if (anObj.P2().IsInit())
aRes->AddFils(::ToXMLTree(std::string("P2"),anObj.P2().Val())->ReTagThis("P2"));
if (anObj.b1().IsInit())
aRes->AddFils(::ToXMLTree(std::string("b1"),anObj.b1().Val())->ReTagThis("b1"));
if (anObj.b2().IsInit())
aRes->AddFils(::ToXMLTree(std::string("b2"),anObj.b2().Val())->ReTagThis("b2"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCalibrationInternePghrStd & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.RadialePart(),aTree->Get("RadialePart",1)); //tototo
xml_init(anObj.P1(),aTree->Get("P1",1),double(0.0)); //tototo
xml_init(anObj.P2(),aTree->Get("P2",1),double(0.0)); //tototo
xml_init(anObj.b1(),aTree->Get("b1",1),double(0.0)); //tototo
xml_init(anObj.b2(),aTree->Get("b2",1),double(0.0)); //tototo
}
std::string Mangling( cCalibrationInternePghrStd *) {return "26AD6F7176EF41ADFE3F";};
eModelesCalibUnif & cCalibrationInterneUnif::TypeModele()
{
return mTypeModele;
}
const eModelesCalibUnif & cCalibrationInterneUnif::TypeModele()const
{
return mTypeModele;
}
std::vector< double > & cCalibrationInterneUnif::Params()
{
return mParams;
}
const std::vector< double > & cCalibrationInterneUnif::Params()const
{
return mParams;
}
std::vector< double > & cCalibrationInterneUnif::Etats()
{
return mEtats;
}
const std::vector< double > & cCalibrationInterneUnif::Etats()const
{
return mEtats;
}
void BinaryUnDumpFromFile(cCalibrationInterneUnif & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.TypeModele(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
double aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Params().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
double aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Etats().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCalibrationInterneUnif & anObj)
{
BinaryDumpInFile(aFp,anObj.TypeModele());
BinaryDumpInFile(aFp,(int)anObj.Params().size());
for( std::vector< double >::const_iterator iT=anObj.Params().begin();
iT!=anObj.Params().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.Etats().size());
for( std::vector< double >::const_iterator iT=anObj.Etats().begin();
iT!=anObj.Etats().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cCalibrationInterneUnif & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CalibrationInterneUnif",eXMLBranche);
aRes->AddFils(ToXMLTree(std::string("TypeModele"),anObj.TypeModele())->ReTagThis("TypeModele"));
for
( std::vector< double >::const_iterator it=anObj.Params().begin();
it !=anObj.Params().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Params"),(*it))->ReTagThis("Params"));
for
( std::vector< double >::const_iterator it=anObj.Etats().begin();
it !=anObj.Etats().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Etats"),(*it))->ReTagThis("Etats"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCalibrationInterneUnif & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.TypeModele(),aTree->Get("TypeModele",1)); //tototo
xml_init(anObj.Params(),aTree->GetAll("Params",false,1));
xml_init(anObj.Etats(),aTree->GetAll("Etats",false,1));
}
std::string Mangling( cCalibrationInterneUnif *) {return "006F5F61C105AAEBFC3F";};
std::string & cTestNewGrid::A()
{
return mA;
}
const std::string & cTestNewGrid::A()const
{
return mA;
}
Im2D_INT1 & cTestNewGrid::Im()
{
return mIm;
}
const Im2D_INT1 & cTestNewGrid::Im()const
{
return mIm;
}
std::string & cTestNewGrid::Z()
{
return mZ;
}
const std::string & cTestNewGrid::Z()const
{
return mZ;
}
void BinaryUnDumpFromFile(cTestNewGrid & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.A(),aFp);
BinaryUnDumpFromFile(anObj.Im(),aFp);
BinaryUnDumpFromFile(anObj.Z(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cTestNewGrid & anObj)
{
BinaryDumpInFile(aFp,anObj.A());
BinaryDumpInFile(aFp,anObj.Im());
BinaryDumpInFile(aFp,anObj.Z());
}
cElXMLTree * ToXMLTree(const cTestNewGrid & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"TestNewGrid",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("A"),anObj.A())->ReTagThis("A"));
aRes->AddFils(::ToXMLTree(std::string("Im"),anObj.Im())->ReTagThis("Im"));
aRes->AddFils(::ToXMLTree(std::string("Z"),anObj.Z())->ReTagThis("Z"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cTestNewGrid & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.A(),aTree->Get("A",1)); //tototo
xml_init(anObj.Im(),aTree->Get("Im",1)); //tototo
xml_init(anObj.Z(),aTree->Get("Z",1)); //tototo
}
std::string Mangling( cTestNewGrid *) {return "C6C1287A857D21C7FD3F";};
Pt2dr & cGridDeform2D::Origine()
{
return mOrigine;
}
const Pt2dr & cGridDeform2D::Origine()const
{
return mOrigine;
}
Pt2dr & cGridDeform2D::Step()
{
return mStep;
}
const Pt2dr & cGridDeform2D::Step()const
{
return mStep;
}
Im2D_REAL8 & cGridDeform2D::ImX()
{
return mImX;
}
const Im2D_REAL8 & cGridDeform2D::ImX()const
{
return mImX;
}
Im2D_REAL8 & cGridDeform2D::ImY()
{
return mImY;
}
const Im2D_REAL8 & cGridDeform2D::ImY()const
{
return mImY;
}
void BinaryUnDumpFromFile(cGridDeform2D & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Origine(),aFp);
BinaryUnDumpFromFile(anObj.Step(),aFp);
BinaryUnDumpFromFile(anObj.ImX(),aFp);
BinaryUnDumpFromFile(anObj.ImY(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cGridDeform2D & anObj)
{
BinaryDumpInFile(aFp,anObj.Origine());
BinaryDumpInFile(aFp,anObj.Step());
BinaryDumpInFile(aFp,anObj.ImX());
BinaryDumpInFile(aFp,anObj.ImY());
}
cElXMLTree * ToXMLTree(const cGridDeform2D & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"GridDeform2D",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Origine"),anObj.Origine())->ReTagThis("Origine"));
aRes->AddFils(::ToXMLTree(std::string("Step"),anObj.Step())->ReTagThis("Step"));
aRes->AddFils(::ToXMLTree(std::string("ImX"),anObj.ImX())->ReTagThis("ImX"));
aRes->AddFils(::ToXMLTree(std::string("ImY"),anObj.ImY())->ReTagThis("ImY"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cGridDeform2D & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Origine(),aTree->Get("Origine",1)); //tototo
xml_init(anObj.Step(),aTree->Get("Step",1)); //tototo
xml_init(anObj.ImX(),aTree->Get("ImX",1)); //tototo
xml_init(anObj.ImY(),aTree->Get("ImY",1)); //tototo
}
std::string Mangling( cGridDeform2D *) {return "4CABA2FBB21E4D8CFE3F";};
cGridDeform2D & cGridDirecteEtInverse::Directe()
{
return mDirecte;
}
const cGridDeform2D & cGridDirecteEtInverse::Directe()const
{
return mDirecte;
}
cGridDeform2D & cGridDirecteEtInverse::Inverse()
{
return mInverse;
}
const cGridDeform2D & cGridDirecteEtInverse::Inverse()const
{
return mInverse;
}
bool & cGridDirecteEtInverse::AdaptStep()
{
return mAdaptStep;
}
const bool & cGridDirecteEtInverse::AdaptStep()const
{
return mAdaptStep;
}
void BinaryUnDumpFromFile(cGridDirecteEtInverse & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Directe(),aFp);
BinaryUnDumpFromFile(anObj.Inverse(),aFp);
BinaryUnDumpFromFile(anObj.AdaptStep(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cGridDirecteEtInverse & anObj)
{
BinaryDumpInFile(aFp,anObj.Directe());
BinaryDumpInFile(aFp,anObj.Inverse());
BinaryDumpInFile(aFp,anObj.AdaptStep());
}
cElXMLTree * ToXMLTree(const cGridDirecteEtInverse & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"GridDirecteEtInverse",eXMLBranche);
aRes->AddFils(ToXMLTree(anObj.Directe())->ReTagThis("Directe"));
aRes->AddFils(ToXMLTree(anObj.Inverse())->ReTagThis("Inverse"));
aRes->AddFils(::ToXMLTree(std::string("AdaptStep"),anObj.AdaptStep())->ReTagThis("AdaptStep"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cGridDirecteEtInverse & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Directe(),aTree->Get("Directe",1)); //tototo
xml_init(anObj.Inverse(),aTree->Get("Inverse",1)); //tototo
xml_init(anObj.AdaptStep(),aTree->Get("AdaptStep",1)); //tototo
}
std::string Mangling( cGridDirecteEtInverse *) {return "4F2BE2AC5A55D8DEFE3F";};
Pt2dr & cPreCondRadial::C()
{
return mC;
}
const Pt2dr & cPreCondRadial::C()const
{
return mC;
}
double & cPreCondRadial::F()
{
return mF;
}
const double & cPreCondRadial::F()const
{
return mF;
}
eTypePreCondRad & cPreCondRadial::Mode()
{
return mMode;
}
const eTypePreCondRad & cPreCondRadial::Mode()const
{
return mMode;
}
void BinaryUnDumpFromFile(cPreCondRadial & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.C(),aFp);
BinaryUnDumpFromFile(anObj.F(),aFp);
BinaryUnDumpFromFile(anObj.Mode(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cPreCondRadial & anObj)
{
BinaryDumpInFile(aFp,anObj.C());
BinaryDumpInFile(aFp,anObj.F());
BinaryDumpInFile(aFp,anObj.Mode());
}
cElXMLTree * ToXMLTree(const cPreCondRadial & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"PreCondRadial",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("C"),anObj.C())->ReTagThis("C"));
aRes->AddFils(::ToXMLTree(std::string("F"),anObj.F())->ReTagThis("F"));
aRes->AddFils(ToXMLTree(std::string("Mode"),anObj.Mode())->ReTagThis("Mode"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cPreCondRadial & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.C(),aTree->Get("C",1)); //tototo
xml_init(anObj.F(),aTree->Get("F",1)); //tototo
xml_init(anObj.Mode(),aTree->Get("Mode",1)); //tototo
}
std::string Mangling( cPreCondRadial *) {return "A15C642AC9E36291FF3F";};
Pt2dr & cPreCondGrid::C()
{
return PreCondRadial().Val().C();
}
const Pt2dr & cPreCondGrid::C()const
{
return PreCondRadial().Val().C();
}
double & cPreCondGrid::F()
{
return PreCondRadial().Val().F();
}
const double & cPreCondGrid::F()const
{
return PreCondRadial().Val().F();
}
eTypePreCondRad & cPreCondGrid::Mode()
{
return PreCondRadial().Val().Mode();
}
const eTypePreCondRad & cPreCondGrid::Mode()const
{
return PreCondRadial().Val().Mode();
}
cTplValGesInit< cPreCondRadial > & cPreCondGrid::PreCondRadial()
{
return mPreCondRadial;
}
const cTplValGesInit< cPreCondRadial > & cPreCondGrid::PreCondRadial()const
{
return mPreCondRadial;
}
void BinaryUnDumpFromFile(cPreCondGrid & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.PreCondRadial().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.PreCondRadial().ValForcedForUnUmp(),aFp);
}
else anObj.PreCondRadial().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cPreCondGrid & anObj)
{
BinaryDumpInFile(aFp,anObj.PreCondRadial().IsInit());
if (anObj.PreCondRadial().IsInit()) BinaryDumpInFile(aFp,anObj.PreCondRadial().Val());
}
cElXMLTree * ToXMLTree(const cPreCondGrid & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"PreCondGrid",eXMLBranche);
if (anObj.PreCondRadial().IsInit())
aRes->AddFils(ToXMLTree(anObj.PreCondRadial().Val())->ReTagThis("PreCondRadial"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cPreCondGrid & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.PreCondRadial(),aTree->Get("PreCondRadial",1)); //tototo
}
std::string Mangling( cPreCondGrid *) {return "CA13F33022DB27C5FD3F";};
Pt2dr & cCalibrationInterneGrid::C()
{
return PreCondGrid().Val().PreCondRadial().Val().C();
}
const Pt2dr & cCalibrationInterneGrid::C()const
{
return PreCondGrid().Val().PreCondRadial().Val().C();
}
double & cCalibrationInterneGrid::F()
{
return PreCondGrid().Val().PreCondRadial().Val().F();
}
const double & cCalibrationInterneGrid::F()const
{
return PreCondGrid().Val().PreCondRadial().Val().F();
}
eTypePreCondRad & cCalibrationInterneGrid::Mode()
{
return PreCondGrid().Val().PreCondRadial().Val().Mode();
}
const eTypePreCondRad & cCalibrationInterneGrid::Mode()const
{
return PreCondGrid().Val().PreCondRadial().Val().Mode();
}
cTplValGesInit< cPreCondRadial > & cCalibrationInterneGrid::PreCondRadial()
{
return PreCondGrid().Val().PreCondRadial();
}
const cTplValGesInit< cPreCondRadial > & cCalibrationInterneGrid::PreCondRadial()const
{
return PreCondGrid().Val().PreCondRadial();
}
cTplValGesInit< cPreCondGrid > & cCalibrationInterneGrid::PreCondGrid()
{
return mPreCondGrid;
}
const cTplValGesInit< cPreCondGrid > & cCalibrationInterneGrid::PreCondGrid()const
{
return mPreCondGrid;
}
cGridDirecteEtInverse & cCalibrationInterneGrid::Grid()
{
return mGrid;
}
const cGridDirecteEtInverse & cCalibrationInterneGrid::Grid()const
{
return mGrid;
}
void BinaryUnDumpFromFile(cCalibrationInterneGrid & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.PreCondGrid().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.PreCondGrid().ValForcedForUnUmp(),aFp);
}
else anObj.PreCondGrid().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.Grid(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCalibrationInterneGrid & anObj)
{
BinaryDumpInFile(aFp,anObj.PreCondGrid().IsInit());
if (anObj.PreCondGrid().IsInit()) BinaryDumpInFile(aFp,anObj.PreCondGrid().Val());
BinaryDumpInFile(aFp,anObj.Grid());
}
cElXMLTree * ToXMLTree(const cCalibrationInterneGrid & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CalibrationInterneGrid",eXMLBranche);
if (anObj.PreCondGrid().IsInit())
aRes->AddFils(ToXMLTree(anObj.PreCondGrid().Val())->ReTagThis("PreCondGrid"));
aRes->AddFils(ToXMLTree(anObj.Grid())->ReTagThis("Grid"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCalibrationInterneGrid & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.PreCondGrid(),aTree->Get("PreCondGrid",1)); //tototo
xml_init(anObj.Grid(),aTree->Get("Grid",1)); //tototo
}
std::string Mangling( cCalibrationInterneGrid *) {return "303E4FE31BAE86BFFD3F";};
Pt2dr & cSimilitudePlane::Scale()
{
return mScale;
}
const Pt2dr & cSimilitudePlane::Scale()const
{
return mScale;
}
Pt2dr & cSimilitudePlane::Trans()
{
return mTrans;
}
const Pt2dr & cSimilitudePlane::Trans()const
{
return mTrans;
}
void BinaryUnDumpFromFile(cSimilitudePlane & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Scale(),aFp);
BinaryUnDumpFromFile(anObj.Trans(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cSimilitudePlane & anObj)
{
BinaryDumpInFile(aFp,anObj.Scale());
BinaryDumpInFile(aFp,anObj.Trans());
}
cElXMLTree * ToXMLTree(const cSimilitudePlane & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"SimilitudePlane",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Scale"),anObj.Scale())->ReTagThis("Scale"));
aRes->AddFils(::ToXMLTree(std::string("Trans"),anObj.Trans())->ReTagThis("Trans"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cSimilitudePlane & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Scale(),aTree->Get("Scale",1)); //tototo
xml_init(anObj.Trans(),aTree->Get("Trans",1)); //tototo
}
std::string Mangling( cSimilitudePlane *) {return "EE18FE2A05BE6887FD3F";};
Pt2dr & cAffinitePlane::I00()
{
return mI00;
}
const Pt2dr & cAffinitePlane::I00()const
{
return mI00;
}
Pt2dr & cAffinitePlane::V10()
{
return mV10;
}
const Pt2dr & cAffinitePlane::V10()const
{
return mV10;
}
Pt2dr & cAffinitePlane::V01()
{
return mV01;
}
const Pt2dr & cAffinitePlane::V01()const
{
return mV01;
}
void BinaryUnDumpFromFile(cAffinitePlane & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.I00(),aFp);
BinaryUnDumpFromFile(anObj.V10(),aFp);
BinaryUnDumpFromFile(anObj.V01(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cAffinitePlane & anObj)
{
BinaryDumpInFile(aFp,anObj.I00());
BinaryDumpInFile(aFp,anObj.V10());
BinaryDumpInFile(aFp,anObj.V01());
}
cElXMLTree * ToXMLTree(const cAffinitePlane & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"AffinitePlane",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("I00"),anObj.I00())->ReTagThis("I00"));
aRes->AddFils(::ToXMLTree(std::string("V10"),anObj.V10())->ReTagThis("V10"));
aRes->AddFils(::ToXMLTree(std::string("V01"),anObj.V01())->ReTagThis("V01"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cAffinitePlane & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.I00(),aTree->Get("I00",1)); //tototo
xml_init(anObj.V10(),aTree->Get("V10",1)); //tototo
xml_init(anObj.V01(),aTree->Get("V01",1)); //tototo
}
std::string Mangling( cAffinitePlane *) {return "3ED1AA4EF9FA47EBFE3F";};
cAffinitePlane & cOrIntGlob::Affinite()
{
return mAffinite;
}
const cAffinitePlane & cOrIntGlob::Affinite()const
{
return mAffinite;
}
bool & cOrIntGlob::C2M()
{
return mC2M;
}
const bool & cOrIntGlob::C2M()const
{
return mC2M;
}
void BinaryUnDumpFromFile(cOrIntGlob & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Affinite(),aFp);
BinaryUnDumpFromFile(anObj.C2M(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cOrIntGlob & anObj)
{
BinaryDumpInFile(aFp,anObj.Affinite());
BinaryDumpInFile(aFp,anObj.C2M());
}
cElXMLTree * ToXMLTree(const cOrIntGlob & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"OrIntGlob",eXMLBranche);
aRes->AddFils(ToXMLTree(anObj.Affinite())->ReTagThis("Affinite"));
aRes->AddFils(::ToXMLTree(std::string("C2M"),anObj.C2M())->ReTagThis("C2M"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cOrIntGlob & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Affinite(),aTree->Get("Affinite",1)); //tototo
xml_init(anObj.C2M(),aTree->Get("C2M",1)); //tototo
}
std::string Mangling( cOrIntGlob *) {return "B7EA9CEC3C25A9F2FD3F";};
Pt2dr & cParamForGrid::StepGrid()
{
return mStepGrid;
}
const Pt2dr & cParamForGrid::StepGrid()const
{
return mStepGrid;
}
double & cParamForGrid::RayonInv()
{
return mRayonInv;
}
const double & cParamForGrid::RayonInv()const
{
return mRayonInv;
}
void BinaryUnDumpFromFile(cParamForGrid & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.StepGrid(),aFp);
BinaryUnDumpFromFile(anObj.RayonInv(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cParamForGrid & anObj)
{
BinaryDumpInFile(aFp,anObj.StepGrid());
BinaryDumpInFile(aFp,anObj.RayonInv());
}
cElXMLTree * ToXMLTree(const cParamForGrid & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ParamForGrid",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("StepGrid"),anObj.StepGrid())->ReTagThis("StepGrid"));
aRes->AddFils(::ToXMLTree(std::string("RayonInv"),anObj.RayonInv())->ReTagThis("RayonInv"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cParamForGrid & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.StepGrid(),aTree->Get("StepGrid",1)); //tototo
xml_init(anObj.RayonInv(),aTree->Get("RayonInv",1)); //tototo
}
std::string Mangling( cParamForGrid *) {return "90532E6FAE4C1092FABF";};
cTplValGesInit< std::string > & cModNoDist::Inutile()
{
return mInutile;
}
const cTplValGesInit< std::string > & cModNoDist::Inutile()const
{
return mInutile;
}
void BinaryUnDumpFromFile(cModNoDist & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Inutile().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Inutile().ValForcedForUnUmp(),aFp);
}
else anObj.Inutile().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cModNoDist & anObj)
{
BinaryDumpInFile(aFp,anObj.Inutile().IsInit());
if (anObj.Inutile().IsInit()) BinaryDumpInFile(aFp,anObj.Inutile().Val());
}
cElXMLTree * ToXMLTree(const cModNoDist & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ModNoDist",eXMLBranche);
if (anObj.Inutile().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Inutile"),anObj.Inutile().Val())->ReTagThis("Inutile"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cModNoDist & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Inutile(),aTree->Get("Inutile",1)); //tototo
}
std::string Mangling( cModNoDist *) {return "10B0B37A531A6994FBBF";};
cTplValGesInit< std::string > & cCalibDistortion::Inutile()
{
return ModNoDist().Val().Inutile();
}
const cTplValGesInit< std::string > & cCalibDistortion::Inutile()const
{
return ModNoDist().Val().Inutile();
}
cTplValGesInit< cModNoDist > & cCalibDistortion::ModNoDist()
{
return mModNoDist;
}
const cTplValGesInit< cModNoDist > & cCalibDistortion::ModNoDist()const
{
return mModNoDist;
}
cTplValGesInit< cCalibrationInterneRadiale > & cCalibDistortion::ModRad()
{
return mModRad;
}
const cTplValGesInit< cCalibrationInterneRadiale > & cCalibDistortion::ModRad()const
{
return mModRad;
}
cTplValGesInit< cCalibrationInternePghrStd > & cCalibDistortion::ModPhgrStd()
{
return mModPhgrStd;
}
const cTplValGesInit< cCalibrationInternePghrStd > & cCalibDistortion::ModPhgrStd()const
{
return mModPhgrStd;
}
cTplValGesInit< cCalibrationInterneUnif > & cCalibDistortion::ModUnif()
{
return mModUnif;
}
const cTplValGesInit< cCalibrationInterneUnif > & cCalibDistortion::ModUnif()const
{
return mModUnif;
}
cTplValGesInit< cCalibrationInterneGrid > & cCalibDistortion::ModGrid()
{
return mModGrid;
}
const cTplValGesInit< cCalibrationInterneGrid > & cCalibDistortion::ModGrid()const
{
return mModGrid;
}
cTplValGesInit< cCalibrationInterneGridDef > & cCalibDistortion::ModGridDef()
{
return mModGridDef;
}
const cTplValGesInit< cCalibrationInterneGridDef > & cCalibDistortion::ModGridDef()const
{
return mModGridDef;
}
void BinaryUnDumpFromFile(cCalibDistortion & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ModNoDist().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ModNoDist().ValForcedForUnUmp(),aFp);
}
else anObj.ModNoDist().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ModRad().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ModRad().ValForcedForUnUmp(),aFp);
}
else anObj.ModRad().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ModPhgrStd().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ModPhgrStd().ValForcedForUnUmp(),aFp);
}
else anObj.ModPhgrStd().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ModUnif().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ModUnif().ValForcedForUnUmp(),aFp);
}
else anObj.ModUnif().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ModGrid().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ModGrid().ValForcedForUnUmp(),aFp);
}
else anObj.ModGrid().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ModGridDef().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ModGridDef().ValForcedForUnUmp(),aFp);
}
else anObj.ModGridDef().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCalibDistortion & anObj)
{
BinaryDumpInFile(aFp,anObj.ModNoDist().IsInit());
if (anObj.ModNoDist().IsInit()) BinaryDumpInFile(aFp,anObj.ModNoDist().Val());
BinaryDumpInFile(aFp,anObj.ModRad().IsInit());
if (anObj.ModRad().IsInit()) BinaryDumpInFile(aFp,anObj.ModRad().Val());
BinaryDumpInFile(aFp,anObj.ModPhgrStd().IsInit());
if (anObj.ModPhgrStd().IsInit()) BinaryDumpInFile(aFp,anObj.ModPhgrStd().Val());
BinaryDumpInFile(aFp,anObj.ModUnif().IsInit());
if (anObj.ModUnif().IsInit()) BinaryDumpInFile(aFp,anObj.ModUnif().Val());
BinaryDumpInFile(aFp,anObj.ModGrid().IsInit());
if (anObj.ModGrid().IsInit()) BinaryDumpInFile(aFp,anObj.ModGrid().Val());
BinaryDumpInFile(aFp,anObj.ModGridDef().IsInit());
if (anObj.ModGridDef().IsInit()) BinaryDumpInFile(aFp,anObj.ModGridDef().Val());
}
cElXMLTree * ToXMLTree(const cCalibDistortion & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CalibDistortion",eXMLBranche);
if (anObj.ModNoDist().IsInit())
aRes->AddFils(ToXMLTree(anObj.ModNoDist().Val())->ReTagThis("ModNoDist"));
if (anObj.ModRad().IsInit())
aRes->AddFils(ToXMLTree(anObj.ModRad().Val())->ReTagThis("ModRad"));
if (anObj.ModPhgrStd().IsInit())
aRes->AddFils(ToXMLTree(anObj.ModPhgrStd().Val())->ReTagThis("ModPhgrStd"));
if (anObj.ModUnif().IsInit())
aRes->AddFils(ToXMLTree(anObj.ModUnif().Val())->ReTagThis("ModUnif"));
if (anObj.ModGrid().IsInit())
aRes->AddFils(ToXMLTree(anObj.ModGrid().Val())->ReTagThis("ModGrid"));
if (anObj.ModGridDef().IsInit())
aRes->AddFils(ToXMLTree(anObj.ModGridDef().Val())->ReTagThis("ModGridDef"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCalibDistortion & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.ModNoDist(),aTree->Get("ModNoDist",1)); //tototo
xml_init(anObj.ModRad(),aTree->Get("ModRad",1)); //tototo
xml_init(anObj.ModPhgrStd(),aTree->Get("ModPhgrStd",1)); //tototo
xml_init(anObj.ModUnif(),aTree->Get("ModUnif",1)); //tototo
xml_init(anObj.ModGrid(),aTree->Get("ModGrid",1)); //tototo
xml_init(anObj.ModGridDef(),aTree->Get("ModGridDef",1)); //tototo
}
std::string Mangling( cCalibDistortion *) {return "7AD625D61A273488FF3F";};
std::string & cCorrectionRefractionAPosteriori::FileEstimCam()
{
return mFileEstimCam;
}
const std::string & cCorrectionRefractionAPosteriori::FileEstimCam()const
{
return mFileEstimCam;
}
cTplValGesInit< std::string > & cCorrectionRefractionAPosteriori::NameTag()
{
return mNameTag;
}
const cTplValGesInit< std::string > & cCorrectionRefractionAPosteriori::NameTag()const
{
return mNameTag;
}
double & cCorrectionRefractionAPosteriori::CoeffRefrac()
{
return mCoeffRefrac;
}
const double & cCorrectionRefractionAPosteriori::CoeffRefrac()const
{
return mCoeffRefrac;
}
cTplValGesInit< bool > & cCorrectionRefractionAPosteriori::IntegreDist()
{
return mIntegreDist;
}
const cTplValGesInit< bool > & cCorrectionRefractionAPosteriori::IntegreDist()const
{
return mIntegreDist;
}
void BinaryUnDumpFromFile(cCorrectionRefractionAPosteriori & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.FileEstimCam(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NameTag().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NameTag().ValForcedForUnUmp(),aFp);
}
else anObj.NameTag().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.CoeffRefrac(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.IntegreDist().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.IntegreDist().ValForcedForUnUmp(),aFp);
}
else anObj.IntegreDist().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCorrectionRefractionAPosteriori & anObj)
{
BinaryDumpInFile(aFp,anObj.FileEstimCam());
BinaryDumpInFile(aFp,anObj.NameTag().IsInit());
if (anObj.NameTag().IsInit()) BinaryDumpInFile(aFp,anObj.NameTag().Val());
BinaryDumpInFile(aFp,anObj.CoeffRefrac());
BinaryDumpInFile(aFp,anObj.IntegreDist().IsInit());
if (anObj.IntegreDist().IsInit()) BinaryDumpInFile(aFp,anObj.IntegreDist().Val());
}
cElXMLTree * ToXMLTree(const cCorrectionRefractionAPosteriori & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CorrectionRefractionAPosteriori",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("FileEstimCam"),anObj.FileEstimCam())->ReTagThis("FileEstimCam"));
if (anObj.NameTag().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NameTag"),anObj.NameTag().Val())->ReTagThis("NameTag"));
aRes->AddFils(::ToXMLTree(std::string("CoeffRefrac"),anObj.CoeffRefrac())->ReTagThis("CoeffRefrac"));
if (anObj.IntegreDist().IsInit())
aRes->AddFils(::ToXMLTree(std::string("IntegreDist"),anObj.IntegreDist().Val())->ReTagThis("IntegreDist"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCorrectionRefractionAPosteriori & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.FileEstimCam(),aTree->Get("FileEstimCam",1)); //tototo
xml_init(anObj.NameTag(),aTree->Get("NameTag",1),std::string("CalibrationInternConique")); //tototo
xml_init(anObj.CoeffRefrac(),aTree->Get("CoeffRefrac",1)); //tototo
xml_init(anObj.IntegreDist(),aTree->Get("IntegreDist",1),bool(false)); //tototo
}
std::string Mangling( cCorrectionRefractionAPosteriori *) {return "400C45B31B4A1CD1FC3F";};
cTplValGesInit< eConventionsOrientation > & cCalibrationInternConique::KnownConv()
{
return mKnownConv;
}
const cTplValGesInit< eConventionsOrientation > & cCalibrationInternConique::KnownConv()const
{
return mKnownConv;
}
std::vector< double > & cCalibrationInternConique::ParamAF()
{
return mParamAF;
}
const std::vector< double > & cCalibrationInternConique::ParamAF()const
{
return mParamAF;
}
Pt2dr & cCalibrationInternConique::PP()
{
return mPP;
}
const Pt2dr & cCalibrationInternConique::PP()const
{
return mPP;
}
double & cCalibrationInternConique::F()
{
return mF;
}
const double & cCalibrationInternConique::F()const
{
return mF;
}
Pt2di & cCalibrationInternConique::SzIm()
{
return mSzIm;
}
const Pt2di & cCalibrationInternConique::SzIm()const
{
return mSzIm;
}
cTplValGesInit< Pt2dr > & cCalibrationInternConique::PixelSzIm()
{
return mPixelSzIm;
}
const cTplValGesInit< Pt2dr > & cCalibrationInternConique::PixelSzIm()const
{
return mPixelSzIm;
}
cTplValGesInit< double > & cCalibrationInternConique::RayonUtile()
{
return mRayonUtile;
}
const cTplValGesInit< double > & cCalibrationInternConique::RayonUtile()const
{
return mRayonUtile;
}
std::vector< bool > & cCalibrationInternConique::ComplIsC2M()
{
return mComplIsC2M;
}
const std::vector< bool > & cCalibrationInternConique::ComplIsC2M()const
{
return mComplIsC2M;
}
cTplValGesInit< bool > & cCalibrationInternConique::ScannedAnalogik()
{
return mScannedAnalogik;
}
const cTplValGesInit< bool > & cCalibrationInternConique::ScannedAnalogik()const
{
return mScannedAnalogik;
}
cAffinitePlane & cCalibrationInternConique::Affinite()
{
return OrIntGlob().Val().Affinite();
}
const cAffinitePlane & cCalibrationInternConique::Affinite()const
{
return OrIntGlob().Val().Affinite();
}
bool & cCalibrationInternConique::C2M()
{
return OrIntGlob().Val().C2M();
}
const bool & cCalibrationInternConique::C2M()const
{
return OrIntGlob().Val().C2M();
}
cTplValGesInit< cOrIntGlob > & cCalibrationInternConique::OrIntGlob()
{
return mOrIntGlob;
}
const cTplValGesInit< cOrIntGlob > & cCalibrationInternConique::OrIntGlob()const
{
return mOrIntGlob;
}
Pt2dr & cCalibrationInternConique::StepGrid()
{
return ParamForGrid().Val().StepGrid();
}
const Pt2dr & cCalibrationInternConique::StepGrid()const
{
return ParamForGrid().Val().StepGrid();
}
double & cCalibrationInternConique::RayonInv()
{
return ParamForGrid().Val().RayonInv();
}
const double & cCalibrationInternConique::RayonInv()const
{
return ParamForGrid().Val().RayonInv();
}
cTplValGesInit< cParamForGrid > & cCalibrationInternConique::ParamForGrid()
{
return mParamForGrid;
}
const cTplValGesInit< cParamForGrid > & cCalibrationInternConique::ParamForGrid()const
{
return mParamForGrid;
}
std::vector< cCalibDistortion > & cCalibrationInternConique::CalibDistortion()
{
return mCalibDistortion;
}
const std::vector< cCalibDistortion > & cCalibrationInternConique::CalibDistortion()const
{
return mCalibDistortion;
}
std::string & cCalibrationInternConique::FileEstimCam()
{
return CorrectionRefractionAPosteriori().Val().FileEstimCam();
}
const std::string & cCalibrationInternConique::FileEstimCam()const
{
return CorrectionRefractionAPosteriori().Val().FileEstimCam();
}
cTplValGesInit< std::string > & cCalibrationInternConique::NameTag()
{
return CorrectionRefractionAPosteriori().Val().NameTag();
}
const cTplValGesInit< std::string > & cCalibrationInternConique::NameTag()const
{
return CorrectionRefractionAPosteriori().Val().NameTag();
}
double & cCalibrationInternConique::CoeffRefrac()
{
return CorrectionRefractionAPosteriori().Val().CoeffRefrac();
}
const double & cCalibrationInternConique::CoeffRefrac()const
{
return CorrectionRefractionAPosteriori().Val().CoeffRefrac();
}
cTplValGesInit< bool > & cCalibrationInternConique::IntegreDist()
{
return CorrectionRefractionAPosteriori().Val().IntegreDist();
}
const cTplValGesInit< bool > & cCalibrationInternConique::IntegreDist()const
{
return CorrectionRefractionAPosteriori().Val().IntegreDist();
}
cTplValGesInit< cCorrectionRefractionAPosteriori > & cCalibrationInternConique::CorrectionRefractionAPosteriori()
{
return mCorrectionRefractionAPosteriori;
}
const cTplValGesInit< cCorrectionRefractionAPosteriori > & cCalibrationInternConique::CorrectionRefractionAPosteriori()const
{
return mCorrectionRefractionAPosteriori;
}
void BinaryUnDumpFromFile(cCalibrationInternConique & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.KnownConv().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.KnownConv().ValForcedForUnUmp(),aFp);
}
else anObj.KnownConv().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
double aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ParamAF().push_back(aVal);
}
} ;
BinaryUnDumpFromFile(anObj.PP(),aFp);
BinaryUnDumpFromFile(anObj.F(),aFp);
BinaryUnDumpFromFile(anObj.SzIm(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.PixelSzIm().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.PixelSzIm().ValForcedForUnUmp(),aFp);
}
else anObj.PixelSzIm().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.RayonUtile().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.RayonUtile().ValForcedForUnUmp(),aFp);
}
else anObj.RayonUtile().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
bool aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ComplIsC2M().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ScannedAnalogik().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ScannedAnalogik().ValForcedForUnUmp(),aFp);
}
else anObj.ScannedAnalogik().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.OrIntGlob().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.OrIntGlob().ValForcedForUnUmp(),aFp);
}
else anObj.OrIntGlob().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ParamForGrid().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ParamForGrid().ValForcedForUnUmp(),aFp);
}
else anObj.ParamForGrid().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cCalibDistortion aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.CalibDistortion().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.CorrectionRefractionAPosteriori().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.CorrectionRefractionAPosteriori().ValForcedForUnUmp(),aFp);
}
else anObj.CorrectionRefractionAPosteriori().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCalibrationInternConique & anObj)
{
BinaryDumpInFile(aFp,anObj.KnownConv().IsInit());
if (anObj.KnownConv().IsInit()) BinaryDumpInFile(aFp,anObj.KnownConv().Val());
BinaryDumpInFile(aFp,(int)anObj.ParamAF().size());
for( std::vector< double >::const_iterator iT=anObj.ParamAF().begin();
iT!=anObj.ParamAF().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.PP());
BinaryDumpInFile(aFp,anObj.F());
BinaryDumpInFile(aFp,anObj.SzIm());
BinaryDumpInFile(aFp,anObj.PixelSzIm().IsInit());
if (anObj.PixelSzIm().IsInit()) BinaryDumpInFile(aFp,anObj.PixelSzIm().Val());
BinaryDumpInFile(aFp,anObj.RayonUtile().IsInit());
if (anObj.RayonUtile().IsInit()) BinaryDumpInFile(aFp,anObj.RayonUtile().Val());
BinaryDumpInFile(aFp,(int)anObj.ComplIsC2M().size());
for( std::vector< bool >::const_iterator iT=anObj.ComplIsC2M().begin();
iT!=anObj.ComplIsC2M().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.ScannedAnalogik().IsInit());
if (anObj.ScannedAnalogik().IsInit()) BinaryDumpInFile(aFp,anObj.ScannedAnalogik().Val());
BinaryDumpInFile(aFp,anObj.OrIntGlob().IsInit());
if (anObj.OrIntGlob().IsInit()) BinaryDumpInFile(aFp,anObj.OrIntGlob().Val());
BinaryDumpInFile(aFp,anObj.ParamForGrid().IsInit());
if (anObj.ParamForGrid().IsInit()) BinaryDumpInFile(aFp,anObj.ParamForGrid().Val());
BinaryDumpInFile(aFp,(int)anObj.CalibDistortion().size());
for( std::vector< cCalibDistortion >::const_iterator iT=anObj.CalibDistortion().begin();
iT!=anObj.CalibDistortion().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.CorrectionRefractionAPosteriori().IsInit());
if (anObj.CorrectionRefractionAPosteriori().IsInit()) BinaryDumpInFile(aFp,anObj.CorrectionRefractionAPosteriori().Val());
}
cElXMLTree * ToXMLTree(const cCalibrationInternConique & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CalibrationInternConique",eXMLBranche);
if (anObj.KnownConv().IsInit())
aRes->AddFils(ToXMLTree(std::string("KnownConv"),anObj.KnownConv().Val())->ReTagThis("KnownConv"));
for
( std::vector< double >::const_iterator it=anObj.ParamAF().begin();
it !=anObj.ParamAF().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("ParamAF"),(*it))->ReTagThis("ParamAF"));
aRes->AddFils(::ToXMLTree(std::string("PP"),anObj.PP())->ReTagThis("PP"));
aRes->AddFils(::ToXMLTree(std::string("F"),anObj.F())->ReTagThis("F"));
aRes->AddFils(::ToXMLTree(std::string("SzIm"),anObj.SzIm())->ReTagThis("SzIm"));
if (anObj.PixelSzIm().IsInit())
aRes->AddFils(::ToXMLTree(std::string("PixelSzIm"),anObj.PixelSzIm().Val())->ReTagThis("PixelSzIm"));
if (anObj.RayonUtile().IsInit())
aRes->AddFils(::ToXMLTree(std::string("RayonUtile"),anObj.RayonUtile().Val())->ReTagThis("RayonUtile"));
for
( std::vector< bool >::const_iterator it=anObj.ComplIsC2M().begin();
it !=anObj.ComplIsC2M().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("ComplIsC2M"),(*it))->ReTagThis("ComplIsC2M"));
if (anObj.ScannedAnalogik().IsInit())
aRes->AddFils(::ToXMLTree(std::string("ScannedAnalogik"),anObj.ScannedAnalogik().Val())->ReTagThis("ScannedAnalogik"));
if (anObj.OrIntGlob().IsInit())
aRes->AddFils(ToXMLTree(anObj.OrIntGlob().Val())->ReTagThis("OrIntGlob"));
if (anObj.ParamForGrid().IsInit())
aRes->AddFils(ToXMLTree(anObj.ParamForGrid().Val())->ReTagThis("ParamForGrid"));
for
( std::vector< cCalibDistortion >::const_iterator it=anObj.CalibDistortion().begin();
it !=anObj.CalibDistortion().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("CalibDistortion"));
if (anObj.CorrectionRefractionAPosteriori().IsInit())
aRes->AddFils(ToXMLTree(anObj.CorrectionRefractionAPosteriori().Val())->ReTagThis("CorrectionRefractionAPosteriori"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCalibrationInternConique & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KnownConv(),aTree->Get("KnownConv",1)); //tototo
xml_init(anObj.ParamAF(),aTree->GetAll("ParamAF",false,1));
xml_init(anObj.PP(),aTree->Get("PP",1)); //tototo
xml_init(anObj.F(),aTree->Get("F",1)); //tototo
xml_init(anObj.SzIm(),aTree->Get("SzIm",1)); //tototo
xml_init(anObj.PixelSzIm(),aTree->Get("PixelSzIm",1)); //tototo
xml_init(anObj.RayonUtile(),aTree->Get("RayonUtile",1)); //tototo
xml_init(anObj.ComplIsC2M(),aTree->GetAll("ComplIsC2M",false,1));
xml_init(anObj.ScannedAnalogik(),aTree->Get("ScannedAnalogik",1),bool(false)); //tototo
xml_init(anObj.OrIntGlob(),aTree->Get("OrIntGlob",1)); //tototo
xml_init(anObj.ParamForGrid(),aTree->Get("ParamForGrid",1)); //tototo
xml_init(anObj.CalibDistortion(),aTree->GetAll("CalibDistortion",false,1));
xml_init(anObj.CorrectionRefractionAPosteriori(),aTree->Get("CorrectionRefractionAPosteriori",1)); //tototo
}
std::string Mangling( cCalibrationInternConique *) {return "58E66CB1E6695BD1FE3F";};
Pt3dr & cRepereCartesien::Ori()
{
return mOri;
}
const Pt3dr & cRepereCartesien::Ori()const
{
return mOri;
}
Pt3dr & cRepereCartesien::Ox()
{
return mOx;
}
const Pt3dr & cRepereCartesien::Ox()const
{
return mOx;
}
Pt3dr & cRepereCartesien::Oy()
{
return mOy;
}
const Pt3dr & cRepereCartesien::Oy()const
{
return mOy;
}
Pt3dr & cRepereCartesien::Oz()
{
return mOz;
}
const Pt3dr & cRepereCartesien::Oz()const
{
return mOz;
}
void BinaryUnDumpFromFile(cRepereCartesien & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Ori(),aFp);
BinaryUnDumpFromFile(anObj.Ox(),aFp);
BinaryUnDumpFromFile(anObj.Oy(),aFp);
BinaryUnDumpFromFile(anObj.Oz(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cRepereCartesien & anObj)
{
BinaryDumpInFile(aFp,anObj.Ori());
BinaryDumpInFile(aFp,anObj.Ox());
BinaryDumpInFile(aFp,anObj.Oy());
BinaryDumpInFile(aFp,anObj.Oz());
}
cElXMLTree * ToXMLTree(const cRepereCartesien & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"RepereCartesien",eXMLBranche);
aRes->AddFils(ToXMLTree(std::string("Ori"),anObj.Ori())->ReTagThis("Ori"));
aRes->AddFils(ToXMLTree(std::string("Ox"),anObj.Ox())->ReTagThis("Ox"));
aRes->AddFils(ToXMLTree(std::string("Oy"),anObj.Oy())->ReTagThis("Oy"));
aRes->AddFils(ToXMLTree(std::string("Oz"),anObj.Oz())->ReTagThis("Oz"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cRepereCartesien & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Ori(),aTree->Get("Ori",1)); //tototo
xml_init(anObj.Ox(),aTree->Get("Ox",1)); //tototo
xml_init(anObj.Oy(),aTree->Get("Oy",1)); //tototo
xml_init(anObj.Oz(),aTree->Get("Oz",1)); //tototo
}
std::string Mangling( cRepereCartesien *) {return "66FDF259A34C1688FD3F";};
Pt3dr & cTypeCodageMatr::L1()
{
return mL1;
}
const Pt3dr & cTypeCodageMatr::L1()const
{
return mL1;
}
Pt3dr & cTypeCodageMatr::L2()
{
return mL2;
}
const Pt3dr & cTypeCodageMatr::L2()const
{
return mL2;
}
Pt3dr & cTypeCodageMatr::L3()
{
return mL3;
}
const Pt3dr & cTypeCodageMatr::L3()const
{
return mL3;
}
cTplValGesInit< bool > & cTypeCodageMatr::TrueRot()
{
return mTrueRot;
}
const cTplValGesInit< bool > & cTypeCodageMatr::TrueRot()const
{
return mTrueRot;
}
void BinaryUnDumpFromFile(cTypeCodageMatr & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.L1(),aFp);
BinaryUnDumpFromFile(anObj.L2(),aFp);
BinaryUnDumpFromFile(anObj.L3(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.TrueRot().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.TrueRot().ValForcedForUnUmp(),aFp);
}
else anObj.TrueRot().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cTypeCodageMatr & anObj)
{
BinaryDumpInFile(aFp,anObj.L1());
BinaryDumpInFile(aFp,anObj.L2());
BinaryDumpInFile(aFp,anObj.L3());
BinaryDumpInFile(aFp,anObj.TrueRot().IsInit());
if (anObj.TrueRot().IsInit()) BinaryDumpInFile(aFp,anObj.TrueRot().Val());
}
cElXMLTree * ToXMLTree(const cTypeCodageMatr & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"TypeCodageMatr",eXMLBranche);
aRes->AddFils(ToXMLTree(std::string("L1"),anObj.L1())->ReTagThis("L1"));
aRes->AddFils(ToXMLTree(std::string("L2"),anObj.L2())->ReTagThis("L2"));
aRes->AddFils(ToXMLTree(std::string("L3"),anObj.L3())->ReTagThis("L3"));
if (anObj.TrueRot().IsInit())
aRes->AddFils(::ToXMLTree(std::string("TrueRot"),anObj.TrueRot().Val())->ReTagThis("TrueRot"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cTypeCodageMatr & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.L1(),aTree->Get("L1",1)); //tototo
xml_init(anObj.L2(),aTree->Get("L2",1)); //tototo
xml_init(anObj.L3(),aTree->Get("L3",1)); //tototo
xml_init(anObj.TrueRot(),aTree->Get("TrueRot",1),bool(true)); //tototo
}
std::string Mangling( cTypeCodageMatr *) {return "80D9B4E09D4A9A92FF3F";};
cTplValGesInit< cTypeCodageMatr > & cRotationVect::CodageMatr()
{
return mCodageMatr;
}
const cTplValGesInit< cTypeCodageMatr > & cRotationVect::CodageMatr()const
{
return mCodageMatr;
}
cTplValGesInit< Pt3dr > & cRotationVect::CodageAngulaire()
{
return mCodageAngulaire;
}
const cTplValGesInit< Pt3dr > & cRotationVect::CodageAngulaire()const
{
return mCodageAngulaire;
}
cTplValGesInit< std::string > & cRotationVect::CodageSymbolique()
{
return mCodageSymbolique;
}
const cTplValGesInit< std::string > & cRotationVect::CodageSymbolique()const
{
return mCodageSymbolique;
}
void BinaryUnDumpFromFile(cRotationVect & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.CodageMatr().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.CodageMatr().ValForcedForUnUmp(),aFp);
}
else anObj.CodageMatr().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.CodageAngulaire().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.CodageAngulaire().ValForcedForUnUmp(),aFp);
}
else anObj.CodageAngulaire().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.CodageSymbolique().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.CodageSymbolique().ValForcedForUnUmp(),aFp);
}
else anObj.CodageSymbolique().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cRotationVect & anObj)
{
BinaryDumpInFile(aFp,anObj.CodageMatr().IsInit());
if (anObj.CodageMatr().IsInit()) BinaryDumpInFile(aFp,anObj.CodageMatr().Val());
BinaryDumpInFile(aFp,anObj.CodageAngulaire().IsInit());
if (anObj.CodageAngulaire().IsInit()) BinaryDumpInFile(aFp,anObj.CodageAngulaire().Val());
BinaryDumpInFile(aFp,anObj.CodageSymbolique().IsInit());
if (anObj.CodageSymbolique().IsInit()) BinaryDumpInFile(aFp,anObj.CodageSymbolique().Val());
}
cElXMLTree * ToXMLTree(const cRotationVect & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"RotationVect",eXMLBranche);
if (anObj.CodageMatr().IsInit())
aRes->AddFils(ToXMLTree(anObj.CodageMatr().Val())->ReTagThis("CodageMatr"));
if (anObj.CodageAngulaire().IsInit())
aRes->AddFils(ToXMLTree(std::string("CodageAngulaire"),anObj.CodageAngulaire().Val())->ReTagThis("CodageAngulaire"));
if (anObj.CodageSymbolique().IsInit())
aRes->AddFils(::ToXMLTree(std::string("CodageSymbolique"),anObj.CodageSymbolique().Val())->ReTagThis("CodageSymbolique"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cRotationVect & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.CodageMatr(),aTree->Get("CodageMatr",1)); //tototo
xml_init(anObj.CodageAngulaire(),aTree->Get("CodageAngulaire",1)); //tototo
xml_init(anObj.CodageSymbolique(),aTree->Get("CodageSymbolique",1)); //tototo
}
std::string Mangling( cRotationVect *) {return "610DC83CDDDCB987FF3F";};
int & cDatePDV::Annee()
{
return mAnnee;
}
const int & cDatePDV::Annee()const
{
return mAnnee;
}
int & cDatePDV::Mois()
{
return mMois;
}
const int & cDatePDV::Mois()const
{
return mMois;
}
int & cDatePDV::Jour()
{
return mJour;
}
const int & cDatePDV::Jour()const
{
return mJour;
}
int & cDatePDV::Heure()
{
return mHeure;
}
const int & cDatePDV::Heure()const
{
return mHeure;
}
int & cDatePDV::Minute()
{
return mMinute;
}
const int & cDatePDV::Minute()const
{
return mMinute;
}
double & cDatePDV::Seconde()
{
return mSeconde;
}
const double & cDatePDV::Seconde()const
{
return mSeconde;
}
void BinaryUnDumpFromFile(cDatePDV & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Annee(),aFp);
BinaryUnDumpFromFile(anObj.Mois(),aFp);
BinaryUnDumpFromFile(anObj.Jour(),aFp);
BinaryUnDumpFromFile(anObj.Heure(),aFp);
BinaryUnDumpFromFile(anObj.Minute(),aFp);
BinaryUnDumpFromFile(anObj.Seconde(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cDatePDV & anObj)
{
BinaryDumpInFile(aFp,anObj.Annee());
BinaryDumpInFile(aFp,anObj.Mois());
BinaryDumpInFile(aFp,anObj.Jour());
BinaryDumpInFile(aFp,anObj.Heure());
BinaryDumpInFile(aFp,anObj.Minute());
BinaryDumpInFile(aFp,anObj.Seconde());
}
cElXMLTree * ToXMLTree(const cDatePDV & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"DatePDV",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Annee"),anObj.Annee())->ReTagThis("Annee"));
aRes->AddFils(::ToXMLTree(std::string("Mois"),anObj.Mois())->ReTagThis("Mois"));
aRes->AddFils(::ToXMLTree(std::string("Jour"),anObj.Jour())->ReTagThis("Jour"));
aRes->AddFils(::ToXMLTree(std::string("Heure"),anObj.Heure())->ReTagThis("Heure"));
aRes->AddFils(::ToXMLTree(std::string("Minute"),anObj.Minute())->ReTagThis("Minute"));
aRes->AddFils(::ToXMLTree(std::string("Seconde"),anObj.Seconde())->ReTagThis("Seconde"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cDatePDV & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Annee(),aTree->Get("Annee",1)); //tototo
xml_init(anObj.Mois(),aTree->Get("Mois",1)); //tototo
xml_init(anObj.Jour(),aTree->Get("Jour",1)); //tototo
xml_init(anObj.Heure(),aTree->Get("Heure",1)); //tototo
xml_init(anObj.Minute(),aTree->Get("Minute",1)); //tototo
xml_init(anObj.Seconde(),aTree->Get("Seconde",1)); //tototo
}
std::string Mangling( cDatePDV *) {return "B6FD9D430DFA9C98FD3F";};
int & cXmlHour::H()
{
return mH;
}
const int & cXmlHour::H()const
{
return mH;
}
int & cXmlHour::M()
{
return mM;
}
const int & cXmlHour::M()const
{
return mM;
}
double & cXmlHour::S()
{
return mS;
}
const double & cXmlHour::S()const
{
return mS;
}
void BinaryUnDumpFromFile(cXmlHour & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.H(),aFp);
BinaryUnDumpFromFile(anObj.M(),aFp);
BinaryUnDumpFromFile(anObj.S(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlHour & anObj)
{
BinaryDumpInFile(aFp,anObj.H());
BinaryDumpInFile(aFp,anObj.M());
BinaryDumpInFile(aFp,anObj.S());
}
cElXMLTree * ToXMLTree(const cXmlHour & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlHour",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("H"),anObj.H())->ReTagThis("H"));
aRes->AddFils(::ToXMLTree(std::string("M"),anObj.M())->ReTagThis("M"));
aRes->AddFils(::ToXMLTree(std::string("S"),anObj.S())->ReTagThis("S"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlHour & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.H(),aTree->Get("H",1)); //tototo
xml_init(anObj.M(),aTree->Get("M",1)); //tototo
xml_init(anObj.S(),aTree->Get("S",1)); //tototo
}
std::string Mangling( cXmlHour *) {return "7DE0121A11584CEAFD3F";};
int & cXmlDate::Y()
{
return mY;
}
const int & cXmlDate::Y()const
{
return mY;
}
int & cXmlDate::M()
{
return mM;
}
const int & cXmlDate::M()const
{
return mM;
}
int & cXmlDate::D()
{
return mD;
}
const int & cXmlDate::D()const
{
return mD;
}
cXmlHour & cXmlDate::Hour()
{
return mHour;
}
const cXmlHour & cXmlDate::Hour()const
{
return mHour;
}
void BinaryUnDumpFromFile(cXmlDate & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Y(),aFp);
BinaryUnDumpFromFile(anObj.M(),aFp);
BinaryUnDumpFromFile(anObj.D(),aFp);
BinaryUnDumpFromFile(anObj.Hour(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlDate & anObj)
{
BinaryDumpInFile(aFp,anObj.Y());
BinaryDumpInFile(aFp,anObj.M());
BinaryDumpInFile(aFp,anObj.D());
BinaryDumpInFile(aFp,anObj.Hour());
}
cElXMLTree * ToXMLTree(const cXmlDate & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlDate",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Y"),anObj.Y())->ReTagThis("Y"));
aRes->AddFils(::ToXMLTree(std::string("M"),anObj.M())->ReTagThis("M"));
aRes->AddFils(::ToXMLTree(std::string("D"),anObj.D())->ReTagThis("D"));
aRes->AddFils(ToXMLTree(anObj.Hour())->ReTagThis("Hour"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlDate & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Y(),aTree->Get("Y",1)); //tototo
xml_init(anObj.M(),aTree->Get("M",1)); //tototo
xml_init(anObj.D(),aTree->Get("D",1)); //tototo
xml_init(anObj.Hour(),aTree->Get("Hour",1)); //tototo
}
std::string Mangling( cXmlDate *) {return "C7D8067DE3BE828CFF3F";};
cTplValGesInit< double > & cOrientationExterneRigide::AltiSol()
{
return mAltiSol;
}
const cTplValGesInit< double > & cOrientationExterneRigide::AltiSol()const
{
return mAltiSol;
}
cTplValGesInit< double > & cOrientationExterneRigide::Profondeur()
{
return mProfondeur;
}
const cTplValGesInit< double > & cOrientationExterneRigide::Profondeur()const
{
return mProfondeur;
}
cTplValGesInit< double > & cOrientationExterneRigide::Time()
{
return mTime;
}
const cTplValGesInit< double > & cOrientationExterneRigide::Time()const
{
return mTime;
}
cTplValGesInit< cXmlDate > & cOrientationExterneRigide::Date()
{
return mDate;
}
const cTplValGesInit< cXmlDate > & cOrientationExterneRigide::Date()const
{
return mDate;
}
cTplValGesInit< eConventionsOrientation > & cOrientationExterneRigide::KnownConv()
{
return mKnownConv;
}
const cTplValGesInit< eConventionsOrientation > & cOrientationExterneRigide::KnownConv()const
{
return mKnownConv;
}
Pt3dr & cOrientationExterneRigide::Centre()
{
return mCentre;
}
const Pt3dr & cOrientationExterneRigide::Centre()const
{
return mCentre;
}
cTplValGesInit< Pt3dr > & cOrientationExterneRigide::OffsetCentre()
{
return mOffsetCentre;
}
const cTplValGesInit< Pt3dr > & cOrientationExterneRigide::OffsetCentre()const
{
return mOffsetCentre;
}
cTplValGesInit< Pt3dr > & cOrientationExterneRigide::Vitesse()
{
return mVitesse;
}
const cTplValGesInit< Pt3dr > & cOrientationExterneRigide::Vitesse()const
{
return mVitesse;
}
cTplValGesInit< bool > & cOrientationExterneRigide::VitesseFiable()
{
return mVitesseFiable;
}
const cTplValGesInit< bool > & cOrientationExterneRigide::VitesseFiable()const
{
return mVitesseFiable;
}
cTplValGesInit< Pt3dr > & cOrientationExterneRigide::IncCentre()
{
return mIncCentre;
}
const cTplValGesInit< Pt3dr > & cOrientationExterneRigide::IncCentre()const
{
return mIncCentre;
}
cRotationVect & cOrientationExterneRigide::ParamRotation()
{
return mParamRotation;
}
const cRotationVect & cOrientationExterneRigide::ParamRotation()const
{
return mParamRotation;
}
void BinaryUnDumpFromFile(cOrientationExterneRigide & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.AltiSol().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.AltiSol().ValForcedForUnUmp(),aFp);
}
else anObj.AltiSol().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Profondeur().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Profondeur().ValForcedForUnUmp(),aFp);
}
else anObj.Profondeur().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Time().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Time().ValForcedForUnUmp(),aFp);
}
else anObj.Time().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Date().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Date().ValForcedForUnUmp(),aFp);
}
else anObj.Date().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.KnownConv().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.KnownConv().ValForcedForUnUmp(),aFp);
}
else anObj.KnownConv().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.Centre(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.OffsetCentre().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.OffsetCentre().ValForcedForUnUmp(),aFp);
}
else anObj.OffsetCentre().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Vitesse().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Vitesse().ValForcedForUnUmp(),aFp);
}
else anObj.Vitesse().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.VitesseFiable().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.VitesseFiable().ValForcedForUnUmp(),aFp);
}
else anObj.VitesseFiable().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.IncCentre().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.IncCentre().ValForcedForUnUmp(),aFp);
}
else anObj.IncCentre().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.ParamRotation(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cOrientationExterneRigide & anObj)
{
BinaryDumpInFile(aFp,anObj.AltiSol().IsInit());
if (anObj.AltiSol().IsInit()) BinaryDumpInFile(aFp,anObj.AltiSol().Val());
BinaryDumpInFile(aFp,anObj.Profondeur().IsInit());
if (anObj.Profondeur().IsInit()) BinaryDumpInFile(aFp,anObj.Profondeur().Val());
BinaryDumpInFile(aFp,anObj.Time().IsInit());
if (anObj.Time().IsInit()) BinaryDumpInFile(aFp,anObj.Time().Val());
BinaryDumpInFile(aFp,anObj.Date().IsInit());
if (anObj.Date().IsInit()) BinaryDumpInFile(aFp,anObj.Date().Val());
BinaryDumpInFile(aFp,anObj.KnownConv().IsInit());
if (anObj.KnownConv().IsInit()) BinaryDumpInFile(aFp,anObj.KnownConv().Val());
BinaryDumpInFile(aFp,anObj.Centre());
BinaryDumpInFile(aFp,anObj.OffsetCentre().IsInit());
if (anObj.OffsetCentre().IsInit()) BinaryDumpInFile(aFp,anObj.OffsetCentre().Val());
BinaryDumpInFile(aFp,anObj.Vitesse().IsInit());
if (anObj.Vitesse().IsInit()) BinaryDumpInFile(aFp,anObj.Vitesse().Val());
BinaryDumpInFile(aFp,anObj.VitesseFiable().IsInit());
if (anObj.VitesseFiable().IsInit()) BinaryDumpInFile(aFp,anObj.VitesseFiable().Val());
BinaryDumpInFile(aFp,anObj.IncCentre().IsInit());
if (anObj.IncCentre().IsInit()) BinaryDumpInFile(aFp,anObj.IncCentre().Val());
BinaryDumpInFile(aFp,anObj.ParamRotation());
}
cElXMLTree * ToXMLTree(const cOrientationExterneRigide & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"OrientationExterneRigide",eXMLBranche);
if (anObj.AltiSol().IsInit())
aRes->AddFils(::ToXMLTree(std::string("AltiSol"),anObj.AltiSol().Val())->ReTagThis("AltiSol"));
if (anObj.Profondeur().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Profondeur"),anObj.Profondeur().Val())->ReTagThis("Profondeur"));
if (anObj.Time().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Time"),anObj.Time().Val())->ReTagThis("Time"));
if (anObj.Date().IsInit())
aRes->AddFils(ToXMLTree(anObj.Date().Val())->ReTagThis("Date"));
if (anObj.KnownConv().IsInit())
aRes->AddFils(ToXMLTree(std::string("KnownConv"),anObj.KnownConv().Val())->ReTagThis("KnownConv"));
aRes->AddFils(ToXMLTree(std::string("Centre"),anObj.Centre())->ReTagThis("Centre"));
if (anObj.OffsetCentre().IsInit())
aRes->AddFils(ToXMLTree(std::string("OffsetCentre"),anObj.OffsetCentre().Val())->ReTagThis("OffsetCentre"));
if (anObj.Vitesse().IsInit())
aRes->AddFils(ToXMLTree(std::string("Vitesse"),anObj.Vitesse().Val())->ReTagThis("Vitesse"));
if (anObj.VitesseFiable().IsInit())
aRes->AddFils(::ToXMLTree(std::string("VitesseFiable"),anObj.VitesseFiable().Val())->ReTagThis("VitesseFiable"));
if (anObj.IncCentre().IsInit())
aRes->AddFils(ToXMLTree(std::string("IncCentre"),anObj.IncCentre().Val())->ReTagThis("IncCentre"));
aRes->AddFils(ToXMLTree(anObj.ParamRotation())->ReTagThis("ParamRotation"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cOrientationExterneRigide & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.AltiSol(),aTree->Get("AltiSol",1)); //tototo
xml_init(anObj.Profondeur(),aTree->Get("Profondeur",1)); //tototo
xml_init(anObj.Time(),aTree->Get("Time",1),double(0.0)); //tototo
xml_init(anObj.Date(),aTree->Get("Date",1)); //tototo
xml_init(anObj.KnownConv(),aTree->Get("KnownConv",1)); //tototo
xml_init(anObj.Centre(),aTree->Get("Centre",1)); //tototo
xml_init(anObj.OffsetCentre(),aTree->Get("OffsetCentre",1)); //tototo
xml_init(anObj.Vitesse(),aTree->Get("Vitesse",1)); //tototo
xml_init(anObj.VitesseFiable(),aTree->Get("VitesseFiable",1),bool(true)); //tototo
xml_init(anObj.IncCentre(),aTree->Get("IncCentre",1)); //tototo
xml_init(anObj.ParamRotation(),aTree->Get("ParamRotation",1)); //tototo
}
std::string Mangling( cOrientationExterneRigide *) {return "028EFB08B288F0AEFF3F";};
std::string & cModuleOrientationFile::NameFileOri()
{
return mNameFileOri;
}
const std::string & cModuleOrientationFile::NameFileOri()const
{
return mNameFileOri;
}
void BinaryUnDumpFromFile(cModuleOrientationFile & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.NameFileOri(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cModuleOrientationFile & anObj)
{
BinaryDumpInFile(aFp,anObj.NameFileOri());
}
cElXMLTree * ToXMLTree(const cModuleOrientationFile & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ModuleOrientationFile",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("NameFileOri"),anObj.NameFileOri())->ReTagThis("NameFileOri"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cModuleOrientationFile & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameFileOri(),aTree->Get("NameFileOri",1)); //tototo
}
std::string Mangling( cModuleOrientationFile *) {return "C0AD0881D8B0D8A7FE3F";};
cTplValGesInit< bool > & cConvExplicite::SensYVideo()
{
return mSensYVideo;
}
const cTplValGesInit< bool > & cConvExplicite::SensYVideo()const
{
return mSensYVideo;
}
cTplValGesInit< bool > & cConvExplicite::DistSenC2M()
{
return mDistSenC2M;
}
const cTplValGesInit< bool > & cConvExplicite::DistSenC2M()const
{
return mDistSenC2M;
}
cTplValGesInit< bool > & cConvExplicite::MatrSenC2M()
{
return mMatrSenC2M;
}
const cTplValGesInit< bool > & cConvExplicite::MatrSenC2M()const
{
return mMatrSenC2M;
}
cTplValGesInit< Pt3dr > & cConvExplicite::ColMul()
{
return mColMul;
}
const cTplValGesInit< Pt3dr > & cConvExplicite::ColMul()const
{
return mColMul;
}
cTplValGesInit< Pt3dr > & cConvExplicite::LigMul()
{
return mLigMul;
}
const cTplValGesInit< Pt3dr > & cConvExplicite::LigMul()const
{
return mLigMul;
}
cTplValGesInit< eUniteAngulaire > & cConvExplicite::UniteAngles()
{
return mUniteAngles;
}
const cTplValGesInit< eUniteAngulaire > & cConvExplicite::UniteAngles()const
{
return mUniteAngles;
}
cTplValGesInit< Pt3di > & cConvExplicite::NumAxe()
{
return mNumAxe;
}
const cTplValGesInit< Pt3di > & cConvExplicite::NumAxe()const
{
return mNumAxe;
}
cTplValGesInit< bool > & cConvExplicite::SensCardan()
{
return mSensCardan;
}
const cTplValGesInit< bool > & cConvExplicite::SensCardan()const
{
return mSensCardan;
}
cTplValGesInit< eConventionsOrientation > & cConvExplicite::Convention()
{
return mConvention;
}
const cTplValGesInit< eConventionsOrientation > & cConvExplicite::Convention()const
{
return mConvention;
}
void BinaryUnDumpFromFile(cConvExplicite & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.SensYVideo().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.SensYVideo().ValForcedForUnUmp(),aFp);
}
else anObj.SensYVideo().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.DistSenC2M().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.DistSenC2M().ValForcedForUnUmp(),aFp);
}
else anObj.DistSenC2M().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.MatrSenC2M().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.MatrSenC2M().ValForcedForUnUmp(),aFp);
}
else anObj.MatrSenC2M().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ColMul().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ColMul().ValForcedForUnUmp(),aFp);
}
else anObj.ColMul().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.LigMul().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.LigMul().ValForcedForUnUmp(),aFp);
}
else anObj.LigMul().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.UniteAngles().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.UniteAngles().ValForcedForUnUmp(),aFp);
}
else anObj.UniteAngles().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NumAxe().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NumAxe().ValForcedForUnUmp(),aFp);
}
else anObj.NumAxe().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.SensCardan().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.SensCardan().ValForcedForUnUmp(),aFp);
}
else anObj.SensCardan().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Convention().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Convention().ValForcedForUnUmp(),aFp);
}
else anObj.Convention().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cConvExplicite & anObj)
{
BinaryDumpInFile(aFp,anObj.SensYVideo().IsInit());
if (anObj.SensYVideo().IsInit()) BinaryDumpInFile(aFp,anObj.SensYVideo().Val());
BinaryDumpInFile(aFp,anObj.DistSenC2M().IsInit());
if (anObj.DistSenC2M().IsInit()) BinaryDumpInFile(aFp,anObj.DistSenC2M().Val());
BinaryDumpInFile(aFp,anObj.MatrSenC2M().IsInit());
if (anObj.MatrSenC2M().IsInit()) BinaryDumpInFile(aFp,anObj.MatrSenC2M().Val());
BinaryDumpInFile(aFp,anObj.ColMul().IsInit());
if (anObj.ColMul().IsInit()) BinaryDumpInFile(aFp,anObj.ColMul().Val());
BinaryDumpInFile(aFp,anObj.LigMul().IsInit());
if (anObj.LigMul().IsInit()) BinaryDumpInFile(aFp,anObj.LigMul().Val());
BinaryDumpInFile(aFp,anObj.UniteAngles().IsInit());
if (anObj.UniteAngles().IsInit()) BinaryDumpInFile(aFp,anObj.UniteAngles().Val());
BinaryDumpInFile(aFp,anObj.NumAxe().IsInit());
if (anObj.NumAxe().IsInit()) BinaryDumpInFile(aFp,anObj.NumAxe().Val());
BinaryDumpInFile(aFp,anObj.SensCardan().IsInit());
if (anObj.SensCardan().IsInit()) BinaryDumpInFile(aFp,anObj.SensCardan().Val());
BinaryDumpInFile(aFp,anObj.Convention().IsInit());
if (anObj.Convention().IsInit()) BinaryDumpInFile(aFp,anObj.Convention().Val());
}
cElXMLTree * ToXMLTree(const cConvExplicite & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ConvExplicite",eXMLBranche);
if (anObj.SensYVideo().IsInit())
aRes->AddFils(::ToXMLTree(std::string("SensYVideo"),anObj.SensYVideo().Val())->ReTagThis("SensYVideo"));
if (anObj.DistSenC2M().IsInit())
aRes->AddFils(::ToXMLTree(std::string("DistSenC2M"),anObj.DistSenC2M().Val())->ReTagThis("DistSenC2M"));
if (anObj.MatrSenC2M().IsInit())
aRes->AddFils(::ToXMLTree(std::string("MatrSenC2M"),anObj.MatrSenC2M().Val())->ReTagThis("MatrSenC2M"));
if (anObj.ColMul().IsInit())
aRes->AddFils(ToXMLTree(std::string("ColMul"),anObj.ColMul().Val())->ReTagThis("ColMul"));
if (anObj.LigMul().IsInit())
aRes->AddFils(ToXMLTree(std::string("LigMul"),anObj.LigMul().Val())->ReTagThis("LigMul"));
if (anObj.UniteAngles().IsInit())
aRes->AddFils(ToXMLTree(std::string("UniteAngles"),anObj.UniteAngles().Val())->ReTagThis("UniteAngles"));
if (anObj.NumAxe().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NumAxe"),anObj.NumAxe().Val())->ReTagThis("NumAxe"));
if (anObj.SensCardan().IsInit())
aRes->AddFils(::ToXMLTree(std::string("SensCardan"),anObj.SensCardan().Val())->ReTagThis("SensCardan"));
if (anObj.Convention().IsInit())
aRes->AddFils(ToXMLTree(std::string("Convention"),anObj.Convention().Val())->ReTagThis("Convention"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cConvExplicite & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.SensYVideo(),aTree->Get("SensYVideo",1),bool(true)); //tototo
xml_init(anObj.DistSenC2M(),aTree->Get("DistSenC2M",1),bool(false)); //tototo
xml_init(anObj.MatrSenC2M(),aTree->Get("MatrSenC2M",1),bool(true)); //tototo
xml_init(anObj.ColMul(),aTree->Get("ColMul",1),Pt3dr(Pt3dr(1,1,1))); //tototo
xml_init(anObj.LigMul(),aTree->Get("LigMul",1),Pt3dr(Pt3dr(1,1,1))); //tototo
xml_init(anObj.UniteAngles(),aTree->Get("UniteAngles",1),eUniteAngulaire(eUniteAngleDegre)); //tototo
xml_init(anObj.NumAxe(),aTree->Get("NumAxe",1),Pt3di(Pt3di(2,1,0))); //tototo
xml_init(anObj.SensCardan(),aTree->Get("SensCardan",1),bool(true)); //tototo
xml_init(anObj.Convention(),aTree->Get("Convention",1),eConventionsOrientation(eConvInconnue)); //tototo
}
std::string Mangling( cConvExplicite *) {return "E5B77365316BA88BFE3F";};
cTplValGesInit< eConventionsOrientation > & cConvOri::KnownConv()
{
return mKnownConv;
}
const cTplValGesInit< eConventionsOrientation > & cConvOri::KnownConv()const
{
return mKnownConv;
}
cTplValGesInit< bool > & cConvOri::SensYVideo()
{
return ConvExplicite().Val().SensYVideo();
}
const cTplValGesInit< bool > & cConvOri::SensYVideo()const
{
return ConvExplicite().Val().SensYVideo();
}
cTplValGesInit< bool > & cConvOri::DistSenC2M()
{
return ConvExplicite().Val().DistSenC2M();
}
const cTplValGesInit< bool > & cConvOri::DistSenC2M()const
{
return ConvExplicite().Val().DistSenC2M();
}
cTplValGesInit< bool > & cConvOri::MatrSenC2M()
{
return ConvExplicite().Val().MatrSenC2M();
}
const cTplValGesInit< bool > & cConvOri::MatrSenC2M()const
{
return ConvExplicite().Val().MatrSenC2M();
}
cTplValGesInit< Pt3dr > & cConvOri::ColMul()
{
return ConvExplicite().Val().ColMul();
}
const cTplValGesInit< Pt3dr > & cConvOri::ColMul()const
{
return ConvExplicite().Val().ColMul();
}
cTplValGesInit< Pt3dr > & cConvOri::LigMul()
{
return ConvExplicite().Val().LigMul();
}
const cTplValGesInit< Pt3dr > & cConvOri::LigMul()const
{
return ConvExplicite().Val().LigMul();
}
cTplValGesInit< eUniteAngulaire > & cConvOri::UniteAngles()
{
return ConvExplicite().Val().UniteAngles();
}
const cTplValGesInit< eUniteAngulaire > & cConvOri::UniteAngles()const
{
return ConvExplicite().Val().UniteAngles();
}
cTplValGesInit< Pt3di > & cConvOri::NumAxe()
{
return ConvExplicite().Val().NumAxe();
}
const cTplValGesInit< Pt3di > & cConvOri::NumAxe()const
{
return ConvExplicite().Val().NumAxe();
}
cTplValGesInit< bool > & cConvOri::SensCardan()
{
return ConvExplicite().Val().SensCardan();
}
const cTplValGesInit< bool > & cConvOri::SensCardan()const
{
return ConvExplicite().Val().SensCardan();
}
cTplValGesInit< eConventionsOrientation > & cConvOri::Convention()
{
return ConvExplicite().Val().Convention();
}
const cTplValGesInit< eConventionsOrientation > & cConvOri::Convention()const
{
return ConvExplicite().Val().Convention();
}
cTplValGesInit< cConvExplicite > & cConvOri::ConvExplicite()
{
return mConvExplicite;
}
const cTplValGesInit< cConvExplicite > & cConvOri::ConvExplicite()const
{
return mConvExplicite;
}
void BinaryUnDumpFromFile(cConvOri & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.KnownConv().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.KnownConv().ValForcedForUnUmp(),aFp);
}
else anObj.KnownConv().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ConvExplicite().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ConvExplicite().ValForcedForUnUmp(),aFp);
}
else anObj.ConvExplicite().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cConvOri & anObj)
{
BinaryDumpInFile(aFp,anObj.KnownConv().IsInit());
if (anObj.KnownConv().IsInit()) BinaryDumpInFile(aFp,anObj.KnownConv().Val());
BinaryDumpInFile(aFp,anObj.ConvExplicite().IsInit());
if (anObj.ConvExplicite().IsInit()) BinaryDumpInFile(aFp,anObj.ConvExplicite().Val());
}
cElXMLTree * ToXMLTree(const cConvOri & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ConvOri",eXMLBranche);
if (anObj.KnownConv().IsInit())
aRes->AddFils(ToXMLTree(std::string("KnownConv"),anObj.KnownConv().Val())->ReTagThis("KnownConv"));
if (anObj.ConvExplicite().IsInit())
aRes->AddFils(ToXMLTree(anObj.ConvExplicite().Val())->ReTagThis("ConvExplicite"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cConvOri & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KnownConv(),aTree->Get("KnownConv",1)); //tototo
xml_init(anObj.ConvExplicite(),aTree->Get("ConvExplicite",1)); //tototo
}
std::string Mangling( cConvOri *) {return "79FF9A6E30E7969EFD3F";};
std::string & cOrientationConique::NameFileOri()
{
return ModuleOrientationFile().Val().NameFileOri();
}
const std::string & cOrientationConique::NameFileOri()const
{
return ModuleOrientationFile().Val().NameFileOri();
}
cTplValGesInit< cModuleOrientationFile > & cOrientationConique::ModuleOrientationFile()
{
return mModuleOrientationFile;
}
const cTplValGesInit< cModuleOrientationFile > & cOrientationConique::ModuleOrientationFile()const
{
return mModuleOrientationFile;
}
cTplValGesInit< cAffinitePlane > & cOrientationConique::OrIntImaM2C()
{
return mOrIntImaM2C;
}
const cTplValGesInit< cAffinitePlane > & cOrientationConique::OrIntImaM2C()const
{
return mOrIntImaM2C;
}
cTplValGesInit< eTypeProjectionCam > & cOrientationConique::TypeProj()
{
return mTypeProj;
}
const cTplValGesInit< eTypeProjectionCam > & cOrientationConique::TypeProj()const
{
return mTypeProj;
}
cTplValGesInit< bool > & cOrientationConique::ZoneUtileInPixel()
{
return mZoneUtileInPixel;
}
const cTplValGesInit< bool > & cOrientationConique::ZoneUtileInPixel()const
{
return mZoneUtileInPixel;
}
cTplValGesInit< cCalibrationInternConique > & cOrientationConique::Interne()
{
return mInterne;
}
const cTplValGesInit< cCalibrationInternConique > & cOrientationConique::Interne()const
{
return mInterne;
}
cTplValGesInit< std::string > & cOrientationConique::FileInterne()
{
return mFileInterne;
}
const cTplValGesInit< std::string > & cOrientationConique::FileInterne()const
{
return mFileInterne;
}
cTplValGesInit< bool > & cOrientationConique::RelativeNameFI()
{
return mRelativeNameFI;
}
const cTplValGesInit< bool > & cOrientationConique::RelativeNameFI()const
{
return mRelativeNameFI;
}
cOrientationExterneRigide & cOrientationConique::Externe()
{
return mExterne;
}
const cOrientationExterneRigide & cOrientationConique::Externe()const
{
return mExterne;
}
cTplValGesInit< cVerifOrient > & cOrientationConique::Verif()
{
return mVerif;
}
const cTplValGesInit< cVerifOrient > & cOrientationConique::Verif()const
{
return mVerif;
}
cTplValGesInit< eConventionsOrientation > & cOrientationConique::KnownConv()
{
return ConvOri().KnownConv();
}
const cTplValGesInit< eConventionsOrientation > & cOrientationConique::KnownConv()const
{
return ConvOri().KnownConv();
}
cTplValGesInit< bool > & cOrientationConique::SensYVideo()
{
return ConvOri().ConvExplicite().Val().SensYVideo();
}
const cTplValGesInit< bool > & cOrientationConique::SensYVideo()const
{
return ConvOri().ConvExplicite().Val().SensYVideo();
}
cTplValGesInit< bool > & cOrientationConique::DistSenC2M()
{
return ConvOri().ConvExplicite().Val().DistSenC2M();
}
const cTplValGesInit< bool > & cOrientationConique::DistSenC2M()const
{
return ConvOri().ConvExplicite().Val().DistSenC2M();
}
cTplValGesInit< bool > & cOrientationConique::MatrSenC2M()
{
return ConvOri().ConvExplicite().Val().MatrSenC2M();
}
const cTplValGesInit< bool > & cOrientationConique::MatrSenC2M()const
{
return ConvOri().ConvExplicite().Val().MatrSenC2M();
}
cTplValGesInit< Pt3dr > & cOrientationConique::ColMul()
{
return ConvOri().ConvExplicite().Val().ColMul();
}
const cTplValGesInit< Pt3dr > & cOrientationConique::ColMul()const
{
return ConvOri().ConvExplicite().Val().ColMul();
}
cTplValGesInit< Pt3dr > & cOrientationConique::LigMul()
{
return ConvOri().ConvExplicite().Val().LigMul();
}
const cTplValGesInit< Pt3dr > & cOrientationConique::LigMul()const
{
return ConvOri().ConvExplicite().Val().LigMul();
}
cTplValGesInit< eUniteAngulaire > & cOrientationConique::UniteAngles()
{
return ConvOri().ConvExplicite().Val().UniteAngles();
}
const cTplValGesInit< eUniteAngulaire > & cOrientationConique::UniteAngles()const
{
return ConvOri().ConvExplicite().Val().UniteAngles();
}
cTplValGesInit< Pt3di > & cOrientationConique::NumAxe()
{
return ConvOri().ConvExplicite().Val().NumAxe();
}
const cTplValGesInit< Pt3di > & cOrientationConique::NumAxe()const
{
return ConvOri().ConvExplicite().Val().NumAxe();
}
cTplValGesInit< bool > & cOrientationConique::SensCardan()
{
return ConvOri().ConvExplicite().Val().SensCardan();
}
const cTplValGesInit< bool > & cOrientationConique::SensCardan()const
{
return ConvOri().ConvExplicite().Val().SensCardan();
}
cTplValGesInit< eConventionsOrientation > & cOrientationConique::Convention()
{
return ConvOri().ConvExplicite().Val().Convention();
}
const cTplValGesInit< eConventionsOrientation > & cOrientationConique::Convention()const
{
return ConvOri().ConvExplicite().Val().Convention();
}
cTplValGesInit< cConvExplicite > & cOrientationConique::ConvExplicite()
{
return ConvOri().ConvExplicite();
}
const cTplValGesInit< cConvExplicite > & cOrientationConique::ConvExplicite()const
{
return ConvOri().ConvExplicite();
}
cConvOri & cOrientationConique::ConvOri()
{
return mConvOri;
}
const cConvOri & cOrientationConique::ConvOri()const
{
return mConvOri;
}
void BinaryUnDumpFromFile(cOrientationConique & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ModuleOrientationFile().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ModuleOrientationFile().ValForcedForUnUmp(),aFp);
}
else anObj.ModuleOrientationFile().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.OrIntImaM2C().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.OrIntImaM2C().ValForcedForUnUmp(),aFp);
}
else anObj.OrIntImaM2C().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.TypeProj().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.TypeProj().ValForcedForUnUmp(),aFp);
}
else anObj.TypeProj().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ZoneUtileInPixel().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ZoneUtileInPixel().ValForcedForUnUmp(),aFp);
}
else anObj.ZoneUtileInPixel().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Interne().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Interne().ValForcedForUnUmp(),aFp);
}
else anObj.Interne().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.FileInterne().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.FileInterne().ValForcedForUnUmp(),aFp);
}
else anObj.FileInterne().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.RelativeNameFI().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.RelativeNameFI().ValForcedForUnUmp(),aFp);
}
else anObj.RelativeNameFI().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.Externe(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Verif().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Verif().ValForcedForUnUmp(),aFp);
}
else anObj.Verif().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.ConvOri(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cOrientationConique & anObj)
{
BinaryDumpInFile(aFp,anObj.ModuleOrientationFile().IsInit());
if (anObj.ModuleOrientationFile().IsInit()) BinaryDumpInFile(aFp,anObj.ModuleOrientationFile().Val());
BinaryDumpInFile(aFp,anObj.OrIntImaM2C().IsInit());
if (anObj.OrIntImaM2C().IsInit()) BinaryDumpInFile(aFp,anObj.OrIntImaM2C().Val());
BinaryDumpInFile(aFp,anObj.TypeProj().IsInit());
if (anObj.TypeProj().IsInit()) BinaryDumpInFile(aFp,anObj.TypeProj().Val());
BinaryDumpInFile(aFp,anObj.ZoneUtileInPixel().IsInit());
if (anObj.ZoneUtileInPixel().IsInit()) BinaryDumpInFile(aFp,anObj.ZoneUtileInPixel().Val());
BinaryDumpInFile(aFp,anObj.Interne().IsInit());
if (anObj.Interne().IsInit()) BinaryDumpInFile(aFp,anObj.Interne().Val());
BinaryDumpInFile(aFp,anObj.FileInterne().IsInit());
if (anObj.FileInterne().IsInit()) BinaryDumpInFile(aFp,anObj.FileInterne().Val());
BinaryDumpInFile(aFp,anObj.RelativeNameFI().IsInit());
if (anObj.RelativeNameFI().IsInit()) BinaryDumpInFile(aFp,anObj.RelativeNameFI().Val());
BinaryDumpInFile(aFp,anObj.Externe());
BinaryDumpInFile(aFp,anObj.Verif().IsInit());
if (anObj.Verif().IsInit()) BinaryDumpInFile(aFp,anObj.Verif().Val());
BinaryDumpInFile(aFp,anObj.ConvOri());
}
cElXMLTree * ToXMLTree(const cOrientationConique & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"OrientationConique",eXMLBranche);
if (anObj.ModuleOrientationFile().IsInit())
aRes->AddFils(ToXMLTree(anObj.ModuleOrientationFile().Val())->ReTagThis("ModuleOrientationFile"));
if (anObj.OrIntImaM2C().IsInit())
aRes->AddFils(ToXMLTree(anObj.OrIntImaM2C().Val())->ReTagThis("OrIntImaM2C"));
if (anObj.TypeProj().IsInit())
aRes->AddFils(ToXMLTree(std::string("TypeProj"),anObj.TypeProj().Val())->ReTagThis("TypeProj"));
if (anObj.ZoneUtileInPixel().IsInit())
aRes->AddFils(::ToXMLTree(std::string("ZoneUtileInPixel"),anObj.ZoneUtileInPixel().Val())->ReTagThis("ZoneUtileInPixel"));
if (anObj.Interne().IsInit())
aRes->AddFils(ToXMLTree(anObj.Interne().Val())->ReTagThis("Interne"));
if (anObj.FileInterne().IsInit())
aRes->AddFils(::ToXMLTree(std::string("FileInterne"),anObj.FileInterne().Val())->ReTagThis("FileInterne"));
if (anObj.RelativeNameFI().IsInit())
aRes->AddFils(::ToXMLTree(std::string("RelativeNameFI"),anObj.RelativeNameFI().Val())->ReTagThis("RelativeNameFI"));
aRes->AddFils(ToXMLTree(anObj.Externe())->ReTagThis("Externe"));
if (anObj.Verif().IsInit())
aRes->AddFils(ToXMLTree(anObj.Verif().Val())->ReTagThis("Verif"));
aRes->AddFils(ToXMLTree(anObj.ConvOri())->ReTagThis("ConvOri"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cOrientationConique & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.ModuleOrientationFile(),aTree->Get("ModuleOrientationFile",1)); //tototo
xml_init(anObj.OrIntImaM2C(),aTree->Get("OrIntImaM2C",1)); //tototo
xml_init(anObj.TypeProj(),aTree->Get("TypeProj",1),eTypeProjectionCam(eProjStenope)); //tototo
xml_init(anObj.ZoneUtileInPixel(),aTree->Get("ZoneUtileInPixel",1),bool(false)); //tototo
xml_init(anObj.Interne(),aTree->Get("Interne",1)); //tototo
xml_init(anObj.FileInterne(),aTree->Get("FileInterne",1)); //tototo
xml_init(anObj.RelativeNameFI(),aTree->Get("RelativeNameFI",1),bool(false)); //tototo
xml_init(anObj.Externe(),aTree->Get("Externe",1)); //tototo
xml_init(anObj.Verif(),aTree->Get("Verif",1)); //tototo
xml_init(anObj.ConvOri(),aTree->Get("ConvOri",1)); //tototo
}
std::string Mangling( cOrientationConique *) {return "44FAF4A00D0ECEFEFC3F";};
std::string & cMNT2Cmp::NameIm()
{
return mNameIm;
}
const std::string & cMNT2Cmp::NameIm()const
{
return mNameIm;
}
cTplValGesInit< std::string > & cMNT2Cmp::NameXml()
{
return mNameXml;
}
const cTplValGesInit< std::string > & cMNT2Cmp::NameXml()const
{
return mNameXml;
}
cTplValGesInit< int > & cMNT2Cmp::IdIsRef()
{
return mIdIsRef;
}
const cTplValGesInit< int > & cMNT2Cmp::IdIsRef()const
{
return mIdIsRef;
}
cTplValGesInit< std::string > & cMNT2Cmp::ShorName()
{
return mShorName;
}
const cTplValGesInit< std::string > & cMNT2Cmp::ShorName()const
{
return mShorName;
}
void BinaryUnDumpFromFile(cMNT2Cmp & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.NameIm(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NameXml().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NameXml().ValForcedForUnUmp(),aFp);
}
else anObj.NameXml().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.IdIsRef().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.IdIsRef().ValForcedForUnUmp(),aFp);
}
else anObj.IdIsRef().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ShorName().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ShorName().ValForcedForUnUmp(),aFp);
}
else anObj.ShorName().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cMNT2Cmp & anObj)
{
BinaryDumpInFile(aFp,anObj.NameIm());
BinaryDumpInFile(aFp,anObj.NameXml().IsInit());
if (anObj.NameXml().IsInit()) BinaryDumpInFile(aFp,anObj.NameXml().Val());
BinaryDumpInFile(aFp,anObj.IdIsRef().IsInit());
if (anObj.IdIsRef().IsInit()) BinaryDumpInFile(aFp,anObj.IdIsRef().Val());
BinaryDumpInFile(aFp,anObj.ShorName().IsInit());
if (anObj.ShorName().IsInit()) BinaryDumpInFile(aFp,anObj.ShorName().Val());
}
cElXMLTree * ToXMLTree(const cMNT2Cmp & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"MNT2Cmp",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("NameIm"),anObj.NameIm())->ReTagThis("NameIm"));
if (anObj.NameXml().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NameXml"),anObj.NameXml().Val())->ReTagThis("NameXml"));
if (anObj.IdIsRef().IsInit())
aRes->AddFils(::ToXMLTree(std::string("IdIsRef"),anObj.IdIsRef().Val())->ReTagThis("IdIsRef"));
if (anObj.ShorName().IsInit())
aRes->AddFils(::ToXMLTree(std::string("ShorName"),anObj.ShorName().Val())->ReTagThis("ShorName"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cMNT2Cmp & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameIm(),aTree->Get("NameIm",1)); //tototo
xml_init(anObj.NameXml(),aTree->Get("NameXml",1)); //tototo
xml_init(anObj.IdIsRef(),aTree->Get("IdIsRef",1),int(0)); //tototo
xml_init(anObj.ShorName(),aTree->Get("ShorName",1)); //tototo
}
std::string Mangling( cMNT2Cmp *) {return "081952F23935DDD2FB3F";};
std::list< Pt2di > & cContourPolyCM::Pts()
{
return mPts;
}
const std::list< Pt2di > & cContourPolyCM::Pts()const
{
return mPts;
}
void BinaryUnDumpFromFile(cContourPolyCM & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
Pt2di aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Pts().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cContourPolyCM & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.Pts().size());
for( std::list< Pt2di >::const_iterator iT=anObj.Pts().begin();
iT!=anObj.Pts().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cContourPolyCM & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ContourPolyCM",eXMLBranche);
for
( std::list< Pt2di >::const_iterator it=anObj.Pts().begin();
it !=anObj.Pts().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Pts"),(*it))->ReTagThis("Pts"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cContourPolyCM & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Pts(),aTree->GetAll("Pts",false,1));
}
std::string Mangling( cContourPolyCM *) {return "EAE04C28384AB1B9FE3F";};
std::list< Pt2di > & cEnvellopeZoneCM::Pts()
{
return ContourPolyCM().Val().Pts();
}
const std::list< Pt2di > & cEnvellopeZoneCM::Pts()const
{
return ContourPolyCM().Val().Pts();
}
cTplValGesInit< cContourPolyCM > & cEnvellopeZoneCM::ContourPolyCM()
{
return mContourPolyCM;
}
const cTplValGesInit< cContourPolyCM > & cEnvellopeZoneCM::ContourPolyCM()const
{
return mContourPolyCM;
}
cTplValGesInit< Box2dr > & cEnvellopeZoneCM::BoxContourCM()
{
return mBoxContourCM;
}
const cTplValGesInit< Box2dr > & cEnvellopeZoneCM::BoxContourCM()const
{
return mBoxContourCM;
}
void BinaryUnDumpFromFile(cEnvellopeZoneCM & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ContourPolyCM().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ContourPolyCM().ValForcedForUnUmp(),aFp);
}
else anObj.ContourPolyCM().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.BoxContourCM().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.BoxContourCM().ValForcedForUnUmp(),aFp);
}
else anObj.BoxContourCM().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cEnvellopeZoneCM & anObj)
{
BinaryDumpInFile(aFp,anObj.ContourPolyCM().IsInit());
if (anObj.ContourPolyCM().IsInit()) BinaryDumpInFile(aFp,anObj.ContourPolyCM().Val());
BinaryDumpInFile(aFp,anObj.BoxContourCM().IsInit());
if (anObj.BoxContourCM().IsInit()) BinaryDumpInFile(aFp,anObj.BoxContourCM().Val());
}
cElXMLTree * ToXMLTree(const cEnvellopeZoneCM & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"EnvellopeZoneCM",eXMLBranche);
if (anObj.ContourPolyCM().IsInit())
aRes->AddFils(ToXMLTree(anObj.ContourPolyCM().Val())->ReTagThis("ContourPolyCM"));
if (anObj.BoxContourCM().IsInit())
aRes->AddFils(::ToXMLTree(std::string("BoxContourCM"),anObj.BoxContourCM().Val())->ReTagThis("BoxContourCM"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cEnvellopeZoneCM & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.ContourPolyCM(),aTree->Get("ContourPolyCM",1)); //tototo
xml_init(anObj.BoxContourCM(),aTree->Get("BoxContourCM",1)); //tototo
}
std::string Mangling( cEnvellopeZoneCM *) {return "06A4689B4E500CB6FF3F";};
cTplValGesInit< std::string > & cZoneCmpMnt::NomZone()
{
return mNomZone;
}
const cTplValGesInit< std::string > & cZoneCmpMnt::NomZone()const
{
return mNomZone;
}
std::list< Pt2di > & cZoneCmpMnt::Pts()
{
return EnvellopeZoneCM().ContourPolyCM().Val().Pts();
}
const std::list< Pt2di > & cZoneCmpMnt::Pts()const
{
return EnvellopeZoneCM().ContourPolyCM().Val().Pts();
}
cTplValGesInit< cContourPolyCM > & cZoneCmpMnt::ContourPolyCM()
{
return EnvellopeZoneCM().ContourPolyCM();
}
const cTplValGesInit< cContourPolyCM > & cZoneCmpMnt::ContourPolyCM()const
{
return EnvellopeZoneCM().ContourPolyCM();
}
cTplValGesInit< Box2dr > & cZoneCmpMnt::BoxContourCM()
{
return EnvellopeZoneCM().BoxContourCM();
}
const cTplValGesInit< Box2dr > & cZoneCmpMnt::BoxContourCM()const
{
return EnvellopeZoneCM().BoxContourCM();
}
cEnvellopeZoneCM & cZoneCmpMnt::EnvellopeZoneCM()
{
return mEnvellopeZoneCM;
}
const cEnvellopeZoneCM & cZoneCmpMnt::EnvellopeZoneCM()const
{
return mEnvellopeZoneCM;
}
void BinaryUnDumpFromFile(cZoneCmpMnt & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NomZone().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NomZone().ValForcedForUnUmp(),aFp);
}
else anObj.NomZone().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.EnvellopeZoneCM(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cZoneCmpMnt & anObj)
{
BinaryDumpInFile(aFp,anObj.NomZone().IsInit());
if (anObj.NomZone().IsInit()) BinaryDumpInFile(aFp,anObj.NomZone().Val());
BinaryDumpInFile(aFp,anObj.EnvellopeZoneCM());
}
cElXMLTree * ToXMLTree(const cZoneCmpMnt & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ZoneCmpMnt",eXMLBranche);
if (anObj.NomZone().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NomZone"),anObj.NomZone().Val())->ReTagThis("NomZone"));
aRes->AddFils(ToXMLTree(anObj.EnvellopeZoneCM())->ReTagThis("EnvellopeZoneCM"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cZoneCmpMnt & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NomZone(),aTree->Get("NomZone",1)); //tototo
xml_init(anObj.EnvellopeZoneCM(),aTree->Get("EnvellopeZoneCM",1)); //tototo
}
std::string Mangling( cZoneCmpMnt *) {return "E4316350E67AF8D3FE3F";};
double & cEcartZ::DynVisu()
{
return mDynVisu;
}
const double & cEcartZ::DynVisu()const
{
return mDynVisu;
}
void BinaryUnDumpFromFile(cEcartZ & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.DynVisu(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cEcartZ & anObj)
{
BinaryDumpInFile(aFp,anObj.DynVisu());
}
cElXMLTree * ToXMLTree(const cEcartZ & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"EcartZ",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("DynVisu"),anObj.DynVisu())->ReTagThis("DynVisu"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cEcartZ & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.DynVisu(),aTree->Get("DynVisu",1)); //tototo
}
std::string Mangling( cEcartZ *) {return "D725C7C3FCC91E96FE3F";};
double & cCorrelPente::SzWCP()
{
return mSzWCP;
}
const double & cCorrelPente::SzWCP()const
{
return mSzWCP;
}
double & cCorrelPente::GrMinCP()
{
return mGrMinCP;
}
const double & cCorrelPente::GrMinCP()const
{
return mGrMinCP;
}
void BinaryUnDumpFromFile(cCorrelPente & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.SzWCP(),aFp);
BinaryUnDumpFromFile(anObj.GrMinCP(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCorrelPente & anObj)
{
BinaryDumpInFile(aFp,anObj.SzWCP());
BinaryDumpInFile(aFp,anObj.GrMinCP());
}
cElXMLTree * ToXMLTree(const cCorrelPente & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CorrelPente",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("SzWCP"),anObj.SzWCP())->ReTagThis("SzWCP"));
aRes->AddFils(::ToXMLTree(std::string("GrMinCP"),anObj.GrMinCP())->ReTagThis("GrMinCP"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCorrelPente & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.SzWCP(),aTree->Get("SzWCP",1)); //tototo
xml_init(anObj.GrMinCP(),aTree->Get("GrMinCP",1)); //tototo
}
std::string Mangling( cCorrelPente *) {return "CEACBAD71FE07AECFD3F";};
double & cMesureCmptMnt::DynVisu()
{
return EcartZ().Val().DynVisu();
}
const double & cMesureCmptMnt::DynVisu()const
{
return EcartZ().Val().DynVisu();
}
cTplValGesInit< cEcartZ > & cMesureCmptMnt::EcartZ()
{
return mEcartZ;
}
const cTplValGesInit< cEcartZ > & cMesureCmptMnt::EcartZ()const
{
return mEcartZ;
}
double & cMesureCmptMnt::SzWCP()
{
return CorrelPente().Val().SzWCP();
}
const double & cMesureCmptMnt::SzWCP()const
{
return CorrelPente().Val().SzWCP();
}
double & cMesureCmptMnt::GrMinCP()
{
return CorrelPente().Val().GrMinCP();
}
const double & cMesureCmptMnt::GrMinCP()const
{
return CorrelPente().Val().GrMinCP();
}
cTplValGesInit< cCorrelPente > & cMesureCmptMnt::CorrelPente()
{
return mCorrelPente;
}
const cTplValGesInit< cCorrelPente > & cMesureCmptMnt::CorrelPente()const
{
return mCorrelPente;
}
cTplValGesInit< bool > & cMesureCmptMnt::EcartPente()
{
return mEcartPente;
}
const cTplValGesInit< bool > & cMesureCmptMnt::EcartPente()const
{
return mEcartPente;
}
void BinaryUnDumpFromFile(cMesureCmptMnt & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.EcartZ().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.EcartZ().ValForcedForUnUmp(),aFp);
}
else anObj.EcartZ().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.CorrelPente().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.CorrelPente().ValForcedForUnUmp(),aFp);
}
else anObj.CorrelPente().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.EcartPente().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.EcartPente().ValForcedForUnUmp(),aFp);
}
else anObj.EcartPente().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cMesureCmptMnt & anObj)
{
BinaryDumpInFile(aFp,anObj.EcartZ().IsInit());
if (anObj.EcartZ().IsInit()) BinaryDumpInFile(aFp,anObj.EcartZ().Val());
BinaryDumpInFile(aFp,anObj.CorrelPente().IsInit());
if (anObj.CorrelPente().IsInit()) BinaryDumpInFile(aFp,anObj.CorrelPente().Val());
BinaryDumpInFile(aFp,anObj.EcartPente().IsInit());
if (anObj.EcartPente().IsInit()) BinaryDumpInFile(aFp,anObj.EcartPente().Val());
}
cElXMLTree * ToXMLTree(const cMesureCmptMnt & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"MesureCmptMnt",eXMLBranche);
if (anObj.EcartZ().IsInit())
aRes->AddFils(ToXMLTree(anObj.EcartZ().Val())->ReTagThis("EcartZ"));
if (anObj.CorrelPente().IsInit())
aRes->AddFils(ToXMLTree(anObj.CorrelPente().Val())->ReTagThis("CorrelPente"));
if (anObj.EcartPente().IsInit())
aRes->AddFils(::ToXMLTree(std::string("EcartPente"),anObj.EcartPente().Val())->ReTagThis("EcartPente"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cMesureCmptMnt & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.EcartZ(),aTree->Get("EcartZ",1)); //tototo
xml_init(anObj.CorrelPente(),aTree->Get("CorrelPente",1)); //tototo
xml_init(anObj.EcartPente(),aTree->Get("EcartPente",1),bool(false)); //tototo
}
std::string Mangling( cMesureCmptMnt *) {return "3AFD4955150F15C7FE3F";};
Pt2dr & cCompareMNT::ResolutionPlaniTerrain()
{
return mResolutionPlaniTerrain;
}
const Pt2dr & cCompareMNT::ResolutionPlaniTerrain()const
{
return mResolutionPlaniTerrain;
}
cTplValGesInit< int > & cCompareMNT::RabLoad()
{
return mRabLoad;
}
const cTplValGesInit< int > & cCompareMNT::RabLoad()const
{
return mRabLoad;
}
std::string & cCompareMNT::NameFileRes()
{
return mNameFileRes;
}
const std::string & cCompareMNT::NameFileRes()const
{
return mNameFileRes;
}
cTplValGesInit< bool > & cCompareMNT::VisuInter()
{
return mVisuInter;
}
const cTplValGesInit< bool > & cCompareMNT::VisuInter()const
{
return mVisuInter;
}
std::list< cMNT2Cmp > & cCompareMNT::MNT2Cmp()
{
return mMNT2Cmp;
}
const std::list< cMNT2Cmp > & cCompareMNT::MNT2Cmp()const
{
return mMNT2Cmp;
}
cTplValGesInit< std::string > & cCompareMNT::MasqGlobalCM()
{
return mMasqGlobalCM;
}
const cTplValGesInit< std::string > & cCompareMNT::MasqGlobalCM()const
{
return mMasqGlobalCM;
}
std::list< cZoneCmpMnt > & cCompareMNT::ZoneCmpMnt()
{
return mZoneCmpMnt;
}
const std::list< cZoneCmpMnt > & cCompareMNT::ZoneCmpMnt()const
{
return mZoneCmpMnt;
}
double & cCompareMNT::DynVisu()
{
return MesureCmptMnt().EcartZ().Val().DynVisu();
}
const double & cCompareMNT::DynVisu()const
{
return MesureCmptMnt().EcartZ().Val().DynVisu();
}
cTplValGesInit< cEcartZ > & cCompareMNT::EcartZ()
{
return MesureCmptMnt().EcartZ();
}
const cTplValGesInit< cEcartZ > & cCompareMNT::EcartZ()const
{
return MesureCmptMnt().EcartZ();
}
double & cCompareMNT::SzWCP()
{
return MesureCmptMnt().CorrelPente().Val().SzWCP();
}
const double & cCompareMNT::SzWCP()const
{
return MesureCmptMnt().CorrelPente().Val().SzWCP();
}
double & cCompareMNT::GrMinCP()
{
return MesureCmptMnt().CorrelPente().Val().GrMinCP();
}
const double & cCompareMNT::GrMinCP()const
{
return MesureCmptMnt().CorrelPente().Val().GrMinCP();
}
cTplValGesInit< cCorrelPente > & cCompareMNT::CorrelPente()
{
return MesureCmptMnt().CorrelPente();
}
const cTplValGesInit< cCorrelPente > & cCompareMNT::CorrelPente()const
{
return MesureCmptMnt().CorrelPente();
}
cTplValGesInit< bool > & cCompareMNT::EcartPente()
{
return MesureCmptMnt().EcartPente();
}
const cTplValGesInit< bool > & cCompareMNT::EcartPente()const
{
return MesureCmptMnt().EcartPente();
}
cMesureCmptMnt & cCompareMNT::MesureCmptMnt()
{
return mMesureCmptMnt;
}
const cMesureCmptMnt & cCompareMNT::MesureCmptMnt()const
{
return mMesureCmptMnt;
}
void BinaryUnDumpFromFile(cCompareMNT & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.ResolutionPlaniTerrain(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.RabLoad().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.RabLoad().ValForcedForUnUmp(),aFp);
}
else anObj.RabLoad().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.NameFileRes(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.VisuInter().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.VisuInter().ValForcedForUnUmp(),aFp);
}
else anObj.VisuInter().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cMNT2Cmp aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.MNT2Cmp().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.MasqGlobalCM().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.MasqGlobalCM().ValForcedForUnUmp(),aFp);
}
else anObj.MasqGlobalCM().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cZoneCmpMnt aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ZoneCmpMnt().push_back(aVal);
}
} ;
BinaryUnDumpFromFile(anObj.MesureCmptMnt(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCompareMNT & anObj)
{
BinaryDumpInFile(aFp,anObj.ResolutionPlaniTerrain());
BinaryDumpInFile(aFp,anObj.RabLoad().IsInit());
if (anObj.RabLoad().IsInit()) BinaryDumpInFile(aFp,anObj.RabLoad().Val());
BinaryDumpInFile(aFp,anObj.NameFileRes());
BinaryDumpInFile(aFp,anObj.VisuInter().IsInit());
if (anObj.VisuInter().IsInit()) BinaryDumpInFile(aFp,anObj.VisuInter().Val());
BinaryDumpInFile(aFp,(int)anObj.MNT2Cmp().size());
for( std::list< cMNT2Cmp >::const_iterator iT=anObj.MNT2Cmp().begin();
iT!=anObj.MNT2Cmp().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.MasqGlobalCM().IsInit());
if (anObj.MasqGlobalCM().IsInit()) BinaryDumpInFile(aFp,anObj.MasqGlobalCM().Val());
BinaryDumpInFile(aFp,(int)anObj.ZoneCmpMnt().size());
for( std::list< cZoneCmpMnt >::const_iterator iT=anObj.ZoneCmpMnt().begin();
iT!=anObj.ZoneCmpMnt().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.MesureCmptMnt());
}
cElXMLTree * ToXMLTree(const cCompareMNT & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CompareMNT",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("ResolutionPlaniTerrain"),anObj.ResolutionPlaniTerrain())->ReTagThis("ResolutionPlaniTerrain"));
if (anObj.RabLoad().IsInit())
aRes->AddFils(::ToXMLTree(std::string("RabLoad"),anObj.RabLoad().Val())->ReTagThis("RabLoad"));
aRes->AddFils(::ToXMLTree(std::string("NameFileRes"),anObj.NameFileRes())->ReTagThis("NameFileRes"));
if (anObj.VisuInter().IsInit())
aRes->AddFils(::ToXMLTree(std::string("VisuInter"),anObj.VisuInter().Val())->ReTagThis("VisuInter"));
for
( std::list< cMNT2Cmp >::const_iterator it=anObj.MNT2Cmp().begin();
it !=anObj.MNT2Cmp().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("MNT2Cmp"));
if (anObj.MasqGlobalCM().IsInit())
aRes->AddFils(::ToXMLTree(std::string("MasqGlobalCM"),anObj.MasqGlobalCM().Val())->ReTagThis("MasqGlobalCM"));
for
( std::list< cZoneCmpMnt >::const_iterator it=anObj.ZoneCmpMnt().begin();
it !=anObj.ZoneCmpMnt().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("ZoneCmpMnt"));
aRes->AddFils(ToXMLTree(anObj.MesureCmptMnt())->ReTagThis("MesureCmptMnt"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCompareMNT & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.ResolutionPlaniTerrain(),aTree->Get("ResolutionPlaniTerrain",1)); //tototo
xml_init(anObj.RabLoad(),aTree->Get("RabLoad",1),int(20)); //tototo
xml_init(anObj.NameFileRes(),aTree->Get("NameFileRes",1)); //tototo
xml_init(anObj.VisuInter(),aTree->Get("VisuInter",1),bool(false)); //tototo
xml_init(anObj.MNT2Cmp(),aTree->GetAll("MNT2Cmp",false,1));
xml_init(anObj.MasqGlobalCM(),aTree->Get("MasqGlobalCM",1)); //tototo
xml_init(anObj.ZoneCmpMnt(),aTree->GetAll("ZoneCmpMnt",false,1));
xml_init(anObj.MesureCmptMnt(),aTree->Get("MesureCmptMnt",1)); //tototo
}
std::string Mangling( cCompareMNT *) {return "3D2B62D216188299FD3F";};
cTplValGesInit< double > & cDataBaseNameTransfo::AddFocMul()
{
return mAddFocMul;
}
const cTplValGesInit< double > & cDataBaseNameTransfo::AddFocMul()const
{
return mAddFocMul;
}
cTplValGesInit< std::string > & cDataBaseNameTransfo::Separateur()
{
return mSeparateur;
}
const cTplValGesInit< std::string > & cDataBaseNameTransfo::Separateur()const
{
return mSeparateur;
}
cTplValGesInit< std::string > & cDataBaseNameTransfo::NewKeyId()
{
return mNewKeyId;
}
const cTplValGesInit< std::string > & cDataBaseNameTransfo::NewKeyId()const
{
return mNewKeyId;
}
cTplValGesInit< std::string > & cDataBaseNameTransfo::NewKeyIdAdd()
{
return mNewKeyIdAdd;
}
const cTplValGesInit< std::string > & cDataBaseNameTransfo::NewKeyIdAdd()const
{
return mNewKeyIdAdd;
}
cTplValGesInit< bool > & cDataBaseNameTransfo::NewAddNameCam()
{
return mNewAddNameCam;
}
const cTplValGesInit< bool > & cDataBaseNameTransfo::NewAddNameCam()const
{
return mNewAddNameCam;
}
cTplValGesInit< double > & cDataBaseNameTransfo::NewFocMul()
{
return mNewFocMul;
}
const cTplValGesInit< double > & cDataBaseNameTransfo::NewFocMul()const
{
return mNewFocMul;
}
void BinaryUnDumpFromFile(cDataBaseNameTransfo & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.AddFocMul().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.AddFocMul().ValForcedForUnUmp(),aFp);
}
else anObj.AddFocMul().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Separateur().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Separateur().ValForcedForUnUmp(),aFp);
}
else anObj.Separateur().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NewKeyId().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NewKeyId().ValForcedForUnUmp(),aFp);
}
else anObj.NewKeyId().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NewKeyIdAdd().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NewKeyIdAdd().ValForcedForUnUmp(),aFp);
}
else anObj.NewKeyIdAdd().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NewAddNameCam().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NewAddNameCam().ValForcedForUnUmp(),aFp);
}
else anObj.NewAddNameCam().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NewFocMul().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NewFocMul().ValForcedForUnUmp(),aFp);
}
else anObj.NewFocMul().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cDataBaseNameTransfo & anObj)
{
BinaryDumpInFile(aFp,anObj.AddFocMul().IsInit());
if (anObj.AddFocMul().IsInit()) BinaryDumpInFile(aFp,anObj.AddFocMul().Val());
BinaryDumpInFile(aFp,anObj.Separateur().IsInit());
if (anObj.Separateur().IsInit()) BinaryDumpInFile(aFp,anObj.Separateur().Val());
BinaryDumpInFile(aFp,anObj.NewKeyId().IsInit());
if (anObj.NewKeyId().IsInit()) BinaryDumpInFile(aFp,anObj.NewKeyId().Val());
BinaryDumpInFile(aFp,anObj.NewKeyIdAdd().IsInit());
if (anObj.NewKeyIdAdd().IsInit()) BinaryDumpInFile(aFp,anObj.NewKeyIdAdd().Val());
BinaryDumpInFile(aFp,anObj.NewAddNameCam().IsInit());
if (anObj.NewAddNameCam().IsInit()) BinaryDumpInFile(aFp,anObj.NewAddNameCam().Val());
BinaryDumpInFile(aFp,anObj.NewFocMul().IsInit());
if (anObj.NewFocMul().IsInit()) BinaryDumpInFile(aFp,anObj.NewFocMul().Val());
}
cElXMLTree * ToXMLTree(const cDataBaseNameTransfo & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"DataBaseNameTransfo",eXMLBranche);
if (anObj.AddFocMul().IsInit())
aRes->AddFils(::ToXMLTree(std::string("AddFocMul"),anObj.AddFocMul().Val())->ReTagThis("AddFocMul"));
if (anObj.Separateur().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Separateur"),anObj.Separateur().Val())->ReTagThis("Separateur"));
if (anObj.NewKeyId().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NewKeyId"),anObj.NewKeyId().Val())->ReTagThis("NewKeyId"));
if (anObj.NewKeyIdAdd().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NewKeyIdAdd"),anObj.NewKeyIdAdd().Val())->ReTagThis("NewKeyIdAdd"));
if (anObj.NewAddNameCam().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NewAddNameCam"),anObj.NewAddNameCam().Val())->ReTagThis("NewAddNameCam"));
if (anObj.NewFocMul().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NewFocMul"),anObj.NewFocMul().Val())->ReTagThis("NewFocMul"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cDataBaseNameTransfo & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.AddFocMul(),aTree->Get("AddFocMul",1)); //tototo
xml_init(anObj.Separateur(),aTree->Get("Separateur",1),std::string("%")); //tototo
xml_init(anObj.NewKeyId(),aTree->Get("NewKeyId",1)); //tototo
xml_init(anObj.NewKeyIdAdd(),aTree->Get("NewKeyIdAdd",1)); //tototo
xml_init(anObj.NewAddNameCam(),aTree->Get("NewAddNameCam",1)); //tototo
xml_init(anObj.NewFocMul(),aTree->Get("NewFocMul",1)); //tototo
}
std::string Mangling( cDataBaseNameTransfo *) {return "18527FE6C95E48FDFD3F";};
cTplValGesInit< std::string > & cInterpoleGrille::Directory()
{
return mDirectory;
}
const cTplValGesInit< std::string > & cInterpoleGrille::Directory()const
{
return mDirectory;
}
std::string & cInterpoleGrille::Grille1()
{
return mGrille1;
}
const std::string & cInterpoleGrille::Grille1()const
{
return mGrille1;
}
std::string & cInterpoleGrille::Grille2()
{
return mGrille2;
}
const std::string & cInterpoleGrille::Grille2()const
{
return mGrille2;
}
std::string & cInterpoleGrille::Grille0()
{
return mGrille0;
}
const std::string & cInterpoleGrille::Grille0()const
{
return mGrille0;
}
cTplValGesInit< Pt2dr > & cInterpoleGrille::StepGrid()
{
return mStepGrid;
}
const cTplValGesInit< Pt2dr > & cInterpoleGrille::StepGrid()const
{
return mStepGrid;
}
double & cInterpoleGrille::Focale1()
{
return mFocale1;
}
const double & cInterpoleGrille::Focale1()const
{
return mFocale1;
}
double & cInterpoleGrille::Focale2()
{
return mFocale2;
}
const double & cInterpoleGrille::Focale2()const
{
return mFocale2;
}
double & cInterpoleGrille::Focale0()
{
return mFocale0;
}
const double & cInterpoleGrille::Focale0()const
{
return mFocale0;
}
cTplValGesInit< int > & cInterpoleGrille::NbPtsByIter()
{
return mNbPtsByIter;
}
const cTplValGesInit< int > & cInterpoleGrille::NbPtsByIter()const
{
return mNbPtsByIter;
}
cTplValGesInit< int > & cInterpoleGrille::DegPoly()
{
return mDegPoly;
}
const cTplValGesInit< int > & cInterpoleGrille::DegPoly()const
{
return mDegPoly;
}
cTplValGesInit< eDegreLiberteCPP > & cInterpoleGrille::LiberteCPP()
{
return mLiberteCPP;
}
const cTplValGesInit< eDegreLiberteCPP > & cInterpoleGrille::LiberteCPP()const
{
return mLiberteCPP;
}
void BinaryUnDumpFromFile(cInterpoleGrille & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Directory().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Directory().ValForcedForUnUmp(),aFp);
}
else anObj.Directory().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.Grille1(),aFp);
BinaryUnDumpFromFile(anObj.Grille2(),aFp);
BinaryUnDumpFromFile(anObj.Grille0(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.StepGrid().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.StepGrid().ValForcedForUnUmp(),aFp);
}
else anObj.StepGrid().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.Focale1(),aFp);
BinaryUnDumpFromFile(anObj.Focale2(),aFp);
BinaryUnDumpFromFile(anObj.Focale0(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NbPtsByIter().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NbPtsByIter().ValForcedForUnUmp(),aFp);
}
else anObj.NbPtsByIter().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.DegPoly().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.DegPoly().ValForcedForUnUmp(),aFp);
}
else anObj.DegPoly().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.LiberteCPP().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.LiberteCPP().ValForcedForUnUmp(),aFp);
}
else anObj.LiberteCPP().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cInterpoleGrille & anObj)
{
BinaryDumpInFile(aFp,anObj.Directory().IsInit());
if (anObj.Directory().IsInit()) BinaryDumpInFile(aFp,anObj.Directory().Val());
BinaryDumpInFile(aFp,anObj.Grille1());
BinaryDumpInFile(aFp,anObj.Grille2());
BinaryDumpInFile(aFp,anObj.Grille0());
BinaryDumpInFile(aFp,anObj.StepGrid().IsInit());
if (anObj.StepGrid().IsInit()) BinaryDumpInFile(aFp,anObj.StepGrid().Val());
BinaryDumpInFile(aFp,anObj.Focale1());
BinaryDumpInFile(aFp,anObj.Focale2());
BinaryDumpInFile(aFp,anObj.Focale0());
BinaryDumpInFile(aFp,anObj.NbPtsByIter().IsInit());
if (anObj.NbPtsByIter().IsInit()) BinaryDumpInFile(aFp,anObj.NbPtsByIter().Val());
BinaryDumpInFile(aFp,anObj.DegPoly().IsInit());
if (anObj.DegPoly().IsInit()) BinaryDumpInFile(aFp,anObj.DegPoly().Val());
BinaryDumpInFile(aFp,anObj.LiberteCPP().IsInit());
if (anObj.LiberteCPP().IsInit()) BinaryDumpInFile(aFp,anObj.LiberteCPP().Val());
}
cElXMLTree * ToXMLTree(const cInterpoleGrille & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"InterpoleGrille",eXMLBranche);
if (anObj.Directory().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Directory"),anObj.Directory().Val())->ReTagThis("Directory"));
aRes->AddFils(::ToXMLTree(std::string("Grille1"),anObj.Grille1())->ReTagThis("Grille1"));
aRes->AddFils(::ToXMLTree(std::string("Grille2"),anObj.Grille2())->ReTagThis("Grille2"));
aRes->AddFils(::ToXMLTree(std::string("Grille0"),anObj.Grille0())->ReTagThis("Grille0"));
if (anObj.StepGrid().IsInit())
aRes->AddFils(::ToXMLTree(std::string("StepGrid"),anObj.StepGrid().Val())->ReTagThis("StepGrid"));
aRes->AddFils(::ToXMLTree(std::string("Focale1"),anObj.Focale1())->ReTagThis("Focale1"));
aRes->AddFils(::ToXMLTree(std::string("Focale2"),anObj.Focale2())->ReTagThis("Focale2"));
aRes->AddFils(::ToXMLTree(std::string("Focale0"),anObj.Focale0())->ReTagThis("Focale0"));
if (anObj.NbPtsByIter().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NbPtsByIter"),anObj.NbPtsByIter().Val())->ReTagThis("NbPtsByIter"));
if (anObj.DegPoly().IsInit())
aRes->AddFils(::ToXMLTree(std::string("DegPoly"),anObj.DegPoly().Val())->ReTagThis("DegPoly"));
if (anObj.LiberteCPP().IsInit())
aRes->AddFils(ToXMLTree(std::string("LiberteCPP"),anObj.LiberteCPP().Val())->ReTagThis("LiberteCPP"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cInterpoleGrille & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Directory(),aTree->Get("Directory",1),std::string("")); //tototo
xml_init(anObj.Grille1(),aTree->Get("Grille1",1)); //tototo
xml_init(anObj.Grille2(),aTree->Get("Grille2",1)); //tototo
xml_init(anObj.Grille0(),aTree->Get("Grille0",1)); //tototo
xml_init(anObj.StepGrid(),aTree->Get("StepGrid",1)); //tototo
xml_init(anObj.Focale1(),aTree->Get("Focale1",1)); //tototo
xml_init(anObj.Focale2(),aTree->Get("Focale2",1)); //tototo
xml_init(anObj.Focale0(),aTree->Get("Focale0",1)); //tototo
xml_init(anObj.NbPtsByIter(),aTree->Get("NbPtsByIter",1),int(30)); //tototo
xml_init(anObj.DegPoly(),aTree->Get("DegPoly",1),int(3)); //tototo
xml_init(anObj.LiberteCPP(),aTree->Get("LiberteCPP",1),eDegreLiberteCPP(eCPPLibres)); //tototo
}
std::string Mangling( cInterpoleGrille *) {return "C336A5D1DD1EBEF4FD3F";};
std::string & cOneCalib2Visu::Name()
{
return mName;
}
const std::string & cOneCalib2Visu::Name()const
{
return mName;
}
Pt3dr & cOneCalib2Visu::Coul()
{
return mCoul;
}
const Pt3dr & cOneCalib2Visu::Coul()const
{
return mCoul;
}
void BinaryUnDumpFromFile(cOneCalib2Visu & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Name(),aFp);
BinaryUnDumpFromFile(anObj.Coul(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cOneCalib2Visu & anObj)
{
BinaryDumpInFile(aFp,anObj.Name());
BinaryDumpInFile(aFp,anObj.Coul());
}
cElXMLTree * ToXMLTree(const cOneCalib2Visu & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"OneCalib2Visu",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Name"),anObj.Name())->ReTagThis("Name"));
aRes->AddFils(ToXMLTree(std::string("Coul"),anObj.Coul())->ReTagThis("Coul"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cOneCalib2Visu & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Name(),aTree->Get("Name",1)); //tototo
xml_init(anObj.Coul(),aTree->Get("Coul",1)); //tototo
}
std::string Mangling( cOneCalib2Visu *) {return "F6F0CC04071BBF86FD3F";};
cTplValGesInit< std::string > & cVisuCalibZoom::Directory()
{
return mDirectory;
}
const cTplValGesInit< std::string > & cVisuCalibZoom::Directory()const
{
return mDirectory;
}
Pt2dr & cVisuCalibZoom::SzIm()
{
return mSzIm;
}
const Pt2dr & cVisuCalibZoom::SzIm()const
{
return mSzIm;
}
std::list< cOneCalib2Visu > & cVisuCalibZoom::OneCalib2Visu()
{
return mOneCalib2Visu;
}
const std::list< cOneCalib2Visu > & cVisuCalibZoom::OneCalib2Visu()const
{
return mOneCalib2Visu;
}
void BinaryUnDumpFromFile(cVisuCalibZoom & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Directory().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Directory().ValForcedForUnUmp(),aFp);
}
else anObj.Directory().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.SzIm(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cOneCalib2Visu aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.OneCalib2Visu().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cVisuCalibZoom & anObj)
{
BinaryDumpInFile(aFp,anObj.Directory().IsInit());
if (anObj.Directory().IsInit()) BinaryDumpInFile(aFp,anObj.Directory().Val());
BinaryDumpInFile(aFp,anObj.SzIm());
BinaryDumpInFile(aFp,(int)anObj.OneCalib2Visu().size());
for( std::list< cOneCalib2Visu >::const_iterator iT=anObj.OneCalib2Visu().begin();
iT!=anObj.OneCalib2Visu().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cVisuCalibZoom & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"VisuCalibZoom",eXMLBranche);
if (anObj.Directory().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Directory"),anObj.Directory().Val())->ReTagThis("Directory"));
aRes->AddFils(::ToXMLTree(std::string("SzIm"),anObj.SzIm())->ReTagThis("SzIm"));
for
( std::list< cOneCalib2Visu >::const_iterator it=anObj.OneCalib2Visu().begin();
it !=anObj.OneCalib2Visu().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("OneCalib2Visu"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cVisuCalibZoom & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Directory(),aTree->Get("Directory",1),std::string("")); //tototo
xml_init(anObj.SzIm(),aTree->Get("SzIm",1)); //tototo
xml_init(anObj.OneCalib2Visu(),aTree->GetAll("OneCalib2Visu",false,1));
}
std::string Mangling( cVisuCalibZoom *) {return "2E22ACAF33397CC1FE3F";};
std::string & cFilterLocalisation::KeyAssocOrient()
{
return mKeyAssocOrient;
}
const std::string & cFilterLocalisation::KeyAssocOrient()const
{
return mKeyAssocOrient;
}
std::string & cFilterLocalisation::NameMasq()
{
return mNameMasq;
}
const std::string & cFilterLocalisation::NameMasq()const
{
return mNameMasq;
}
std::string & cFilterLocalisation::NameMTDMasq()
{
return mNameMTDMasq;
}
const std::string & cFilterLocalisation::NameMTDMasq()const
{
return mNameMTDMasq;
}
void BinaryUnDumpFromFile(cFilterLocalisation & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.KeyAssocOrient(),aFp);
BinaryUnDumpFromFile(anObj.NameMasq(),aFp);
BinaryUnDumpFromFile(anObj.NameMTDMasq(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cFilterLocalisation & anObj)
{
BinaryDumpInFile(aFp,anObj.KeyAssocOrient());
BinaryDumpInFile(aFp,anObj.NameMasq());
BinaryDumpInFile(aFp,anObj.NameMTDMasq());
}
cElXMLTree * ToXMLTree(const cFilterLocalisation & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"FilterLocalisation",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("KeyAssocOrient"),anObj.KeyAssocOrient())->ReTagThis("KeyAssocOrient"));
aRes->AddFils(::ToXMLTree(std::string("NameMasq"),anObj.NameMasq())->ReTagThis("NameMasq"));
aRes->AddFils(::ToXMLTree(std::string("NameMTDMasq"),anObj.NameMTDMasq())->ReTagThis("NameMTDMasq"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cFilterLocalisation & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeyAssocOrient(),aTree->Get("KeyAssocOrient",1)); //tototo
xml_init(anObj.NameMasq(),aTree->Get("NameMasq",1)); //tototo
xml_init(anObj.NameMTDMasq(),aTree->Get("NameMTDMasq",1)); //tototo
}
std::string Mangling( cFilterLocalisation *) {return "C08109AC85155FBCFA3F";};
std::list< std::string > & cKeyExistingFile::KeyAssoc()
{
return mKeyAssoc;
}
const std::list< std::string > & cKeyExistingFile::KeyAssoc()const
{
return mKeyAssoc;
}
bool & cKeyExistingFile::RequireExist()
{
return mRequireExist;
}
const bool & cKeyExistingFile::RequireExist()const
{
return mRequireExist;
}
bool & cKeyExistingFile::RequireForAll()
{
return mRequireForAll;
}
const bool & cKeyExistingFile::RequireForAll()const
{
return mRequireForAll;
}
void BinaryUnDumpFromFile(cKeyExistingFile & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.KeyAssoc().push_back(aVal);
}
} ;
BinaryUnDumpFromFile(anObj.RequireExist(),aFp);
BinaryUnDumpFromFile(anObj.RequireForAll(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cKeyExistingFile & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.KeyAssoc().size());
for( std::list< std::string >::const_iterator iT=anObj.KeyAssoc().begin();
iT!=anObj.KeyAssoc().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.RequireExist());
BinaryDumpInFile(aFp,anObj.RequireForAll());
}
cElXMLTree * ToXMLTree(const cKeyExistingFile & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"KeyExistingFile",eXMLBranche);
for
( std::list< std::string >::const_iterator it=anObj.KeyAssoc().begin();
it !=anObj.KeyAssoc().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("KeyAssoc"),(*it))->ReTagThis("KeyAssoc"));
aRes->AddFils(::ToXMLTree(std::string("RequireExist"),anObj.RequireExist())->ReTagThis("RequireExist"));
aRes->AddFils(::ToXMLTree(std::string("RequireForAll"),anObj.RequireForAll())->ReTagThis("RequireForAll"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cKeyExistingFile & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeyAssoc(),aTree->GetAll("KeyAssoc",false,1));
xml_init(anObj.RequireExist(),aTree->Get("RequireExist",1)); //tototo
xml_init(anObj.RequireForAll(),aTree->Get("RequireForAll",1)); //tototo
}
std::string Mangling( cKeyExistingFile *) {return "B6F74E0FB084CF9EFE3F";};
std::list< Pt2drSubst > & cNameFilter::FocMm()
{
return mFocMm;
}
const std::list< Pt2drSubst > & cNameFilter::FocMm()const
{
return mFocMm;
}
cTplValGesInit< std::string > & cNameFilter::Min()
{
return mMin;
}
const cTplValGesInit< std::string > & cNameFilter::Min()const
{
return mMin;
}
cTplValGesInit< std::string > & cNameFilter::Max()
{
return mMax;
}
const cTplValGesInit< std::string > & cNameFilter::Max()const
{
return mMax;
}
cTplValGesInit< int > & cNameFilter::SizeMinFile()
{
return mSizeMinFile;
}
const cTplValGesInit< int > & cNameFilter::SizeMinFile()const
{
return mSizeMinFile;
}
std::list< cKeyExistingFile > & cNameFilter::KeyExistingFile()
{
return mKeyExistingFile;
}
const std::list< cKeyExistingFile > & cNameFilter::KeyExistingFile()const
{
return mKeyExistingFile;
}
cTplValGesInit< cFilterLocalisation > & cNameFilter::KeyLocalisation()
{
return mKeyLocalisation;
}
const cTplValGesInit< cFilterLocalisation > & cNameFilter::KeyLocalisation()const
{
return mKeyLocalisation;
}
void BinaryUnDumpFromFile(cNameFilter & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
Pt2drSubst aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.FocMm().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Min().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Min().ValForcedForUnUmp(),aFp);
}
else anObj.Min().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Max().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Max().ValForcedForUnUmp(),aFp);
}
else anObj.Max().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.SizeMinFile().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.SizeMinFile().ValForcedForUnUmp(),aFp);
}
else anObj.SizeMinFile().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cKeyExistingFile aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.KeyExistingFile().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.KeyLocalisation().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.KeyLocalisation().ValForcedForUnUmp(),aFp);
}
else anObj.KeyLocalisation().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cNameFilter & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.FocMm().size());
for( std::list< Pt2drSubst >::const_iterator iT=anObj.FocMm().begin();
iT!=anObj.FocMm().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.Min().IsInit());
if (anObj.Min().IsInit()) BinaryDumpInFile(aFp,anObj.Min().Val());
BinaryDumpInFile(aFp,anObj.Max().IsInit());
if (anObj.Max().IsInit()) BinaryDumpInFile(aFp,anObj.Max().Val());
BinaryDumpInFile(aFp,anObj.SizeMinFile().IsInit());
if (anObj.SizeMinFile().IsInit()) BinaryDumpInFile(aFp,anObj.SizeMinFile().Val());
BinaryDumpInFile(aFp,(int)anObj.KeyExistingFile().size());
for( std::list< cKeyExistingFile >::const_iterator iT=anObj.KeyExistingFile().begin();
iT!=anObj.KeyExistingFile().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.KeyLocalisation().IsInit());
if (anObj.KeyLocalisation().IsInit()) BinaryDumpInFile(aFp,anObj.KeyLocalisation().Val());
}
cElXMLTree * ToXMLTree(const cNameFilter & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"NameFilter",eXMLBranche);
for
( std::list< Pt2drSubst >::const_iterator it=anObj.FocMm().begin();
it !=anObj.FocMm().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("FocMm"),(*it))->ReTagThis("FocMm"));
if (anObj.Min().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Min"),anObj.Min().Val())->ReTagThis("Min"));
if (anObj.Max().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Max"),anObj.Max().Val())->ReTagThis("Max"));
if (anObj.SizeMinFile().IsInit())
aRes->AddFils(::ToXMLTree(std::string("SizeMinFile"),anObj.SizeMinFile().Val())->ReTagThis("SizeMinFile"));
for
( std::list< cKeyExistingFile >::const_iterator it=anObj.KeyExistingFile().begin();
it !=anObj.KeyExistingFile().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("KeyExistingFile"));
if (anObj.KeyLocalisation().IsInit())
aRes->AddFils(ToXMLTree(anObj.KeyLocalisation().Val())->ReTagThis("KeyLocalisation"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cNameFilter & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.FocMm(),aTree->GetAll("FocMm",false,1));
xml_init(anObj.Min(),aTree->Get("Min",1)); //tototo
xml_init(anObj.Max(),aTree->Get("Max",1)); //tototo
xml_init(anObj.SizeMinFile(),aTree->Get("SizeMinFile",1),int(-1)); //tototo
xml_init(anObj.KeyExistingFile(),aTree->GetAll("KeyExistingFile",false,1));
xml_init(anObj.KeyLocalisation(),aTree->Get("KeyLocalisation",1)); //tototo
}
std::string Mangling( cNameFilter *) {return "C0CEB1E81145A1E6FE3F";};
std::string & cBasicAssocNameToName::PatternTransform()
{
return mPatternTransform;
}
const std::string & cBasicAssocNameToName::PatternTransform()const
{
return mPatternTransform;
}
cTplValGesInit< cDataBaseNameTransfo > & cBasicAssocNameToName::NameTransfo()
{
return mNameTransfo;
}
const cTplValGesInit< cDataBaseNameTransfo > & cBasicAssocNameToName::NameTransfo()const
{
return mNameTransfo;
}
cTplValGesInit< std::string > & cBasicAssocNameToName::PatternSelector()
{
return mPatternSelector;
}
const cTplValGesInit< std::string > & cBasicAssocNameToName::PatternSelector()const
{
return mPatternSelector;
}
std::vector< std::string > & cBasicAssocNameToName::CalcName()
{
return mCalcName;
}
const std::vector< std::string > & cBasicAssocNameToName::CalcName()const
{
return mCalcName;
}
cTplValGesInit< std::string > & cBasicAssocNameToName::Separateur()
{
return mSeparateur;
}
const cTplValGesInit< std::string > & cBasicAssocNameToName::Separateur()const
{
return mSeparateur;
}
cTplValGesInit< cNameFilter > & cBasicAssocNameToName::Filter()
{
return mFilter;
}
const cTplValGesInit< cNameFilter > & cBasicAssocNameToName::Filter()const
{
return mFilter;
}
void BinaryUnDumpFromFile(cBasicAssocNameToName & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.PatternTransform(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NameTransfo().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NameTransfo().ValForcedForUnUmp(),aFp);
}
else anObj.NameTransfo().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.PatternSelector().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.PatternSelector().ValForcedForUnUmp(),aFp);
}
else anObj.PatternSelector().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.CalcName().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Separateur().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Separateur().ValForcedForUnUmp(),aFp);
}
else anObj.Separateur().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Filter().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Filter().ValForcedForUnUmp(),aFp);
}
else anObj.Filter().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cBasicAssocNameToName & anObj)
{
BinaryDumpInFile(aFp,anObj.PatternTransform());
BinaryDumpInFile(aFp,anObj.NameTransfo().IsInit());
if (anObj.NameTransfo().IsInit()) BinaryDumpInFile(aFp,anObj.NameTransfo().Val());
BinaryDumpInFile(aFp,anObj.PatternSelector().IsInit());
if (anObj.PatternSelector().IsInit()) BinaryDumpInFile(aFp,anObj.PatternSelector().Val());
BinaryDumpInFile(aFp,(int)anObj.CalcName().size());
for( std::vector< std::string >::const_iterator iT=anObj.CalcName().begin();
iT!=anObj.CalcName().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.Separateur().IsInit());
if (anObj.Separateur().IsInit()) BinaryDumpInFile(aFp,anObj.Separateur().Val());
BinaryDumpInFile(aFp,anObj.Filter().IsInit());
if (anObj.Filter().IsInit()) BinaryDumpInFile(aFp,anObj.Filter().Val());
}
cElXMLTree * ToXMLTree(const cBasicAssocNameToName & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"BasicAssocNameToName",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("PatternTransform"),anObj.PatternTransform())->ReTagThis("PatternTransform"));
if (anObj.NameTransfo().IsInit())
aRes->AddFils(ToXMLTree(anObj.NameTransfo().Val())->ReTagThis("NameTransfo"));
if (anObj.PatternSelector().IsInit())
aRes->AddFils(::ToXMLTree(std::string("PatternSelector"),anObj.PatternSelector().Val())->ReTagThis("PatternSelector"));
for
( std::vector< std::string >::const_iterator it=anObj.CalcName().begin();
it !=anObj.CalcName().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("CalcName"),(*it))->ReTagThis("CalcName"));
if (anObj.Separateur().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Separateur"),anObj.Separateur().Val())->ReTagThis("Separateur"));
if (anObj.Filter().IsInit())
aRes->AddFils(ToXMLTree(anObj.Filter().Val())->ReTagThis("Filter"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cBasicAssocNameToName & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.PatternTransform(),aTree->Get("PatternTransform",1)); //tototo
xml_init(anObj.NameTransfo(),aTree->Get("NameTransfo",1)); //tototo
xml_init(anObj.PatternSelector(),aTree->Get("PatternSelector",1)); //tototo
xml_init(anObj.CalcName(),aTree->GetAll("CalcName",false,1));
xml_init(anObj.Separateur(),aTree->Get("Separateur",1),std::string("@")); //tototo
xml_init(anObj.Filter(),aTree->Get("Filter",1)); //tototo
}
std::string Mangling( cBasicAssocNameToName *) {return "5E2E3C5E4081C4E0FD3F";};
cTplValGesInit< Pt2di > & cAssocNameToName::Arrite()
{
return mArrite;
}
const cTplValGesInit< Pt2di > & cAssocNameToName::Arrite()const
{
return mArrite;
}
cBasicAssocNameToName & cAssocNameToName::Direct()
{
return mDirect;
}
const cBasicAssocNameToName & cAssocNameToName::Direct()const
{
return mDirect;
}
cTplValGesInit< cBasicAssocNameToName > & cAssocNameToName::Inverse()
{
return mInverse;
}
const cTplValGesInit< cBasicAssocNameToName > & cAssocNameToName::Inverse()const
{
return mInverse;
}
cTplValGesInit< bool > & cAssocNameToName::AutoInverseBySym()
{
return mAutoInverseBySym;
}
const cTplValGesInit< bool > & cAssocNameToName::AutoInverseBySym()const
{
return mAutoInverseBySym;
}
void BinaryUnDumpFromFile(cAssocNameToName & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Arrite().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Arrite().ValForcedForUnUmp(),aFp);
}
else anObj.Arrite().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.Direct(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Inverse().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Inverse().ValForcedForUnUmp(),aFp);
}
else anObj.Inverse().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.AutoInverseBySym().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.AutoInverseBySym().ValForcedForUnUmp(),aFp);
}
else anObj.AutoInverseBySym().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cAssocNameToName & anObj)
{
BinaryDumpInFile(aFp,anObj.Arrite().IsInit());
if (anObj.Arrite().IsInit()) BinaryDumpInFile(aFp,anObj.Arrite().Val());
BinaryDumpInFile(aFp,anObj.Direct());
BinaryDumpInFile(aFp,anObj.Inverse().IsInit());
if (anObj.Inverse().IsInit()) BinaryDumpInFile(aFp,anObj.Inverse().Val());
BinaryDumpInFile(aFp,anObj.AutoInverseBySym().IsInit());
if (anObj.AutoInverseBySym().IsInit()) BinaryDumpInFile(aFp,anObj.AutoInverseBySym().Val());
}
cElXMLTree * ToXMLTree(const cAssocNameToName & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"AssocNameToName",eXMLBranche);
if (anObj.Arrite().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Arrite"),anObj.Arrite().Val())->ReTagThis("Arrite"));
aRes->AddFils(ToXMLTree(anObj.Direct())->ReTagThis("Direct"));
if (anObj.Inverse().IsInit())
aRes->AddFils(ToXMLTree(anObj.Inverse().Val())->ReTagThis("Inverse"));
if (anObj.AutoInverseBySym().IsInit())
aRes->AddFils(::ToXMLTree(std::string("AutoInverseBySym"),anObj.AutoInverseBySym().Val())->ReTagThis("AutoInverseBySym"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cAssocNameToName & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Arrite(),aTree->Get("Arrite",1)); //tototo
xml_init(anObj.Direct(),aTree->Get("Direct",1)); //tototo
xml_init(anObj.Inverse(),aTree->Get("Inverse",1)); //tototo
xml_init(anObj.AutoInverseBySym(),aTree->Get("AutoInverseBySym",1),bool(false)); //tototo
}
std::string Mangling( cAssocNameToName *) {return "42F6EFF5D37B48C2FE3F";};
cTplValGesInit< std::string > & cEtatPims::NameOri()
{
return mNameOri;
}
const cTplValGesInit< std::string > & cEtatPims::NameOri()const
{
return mNameOri;
}
void BinaryUnDumpFromFile(cEtatPims & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NameOri().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NameOri().ValForcedForUnUmp(),aFp);
}
else anObj.NameOri().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cEtatPims & anObj)
{
BinaryDumpInFile(aFp,anObj.NameOri().IsInit());
if (anObj.NameOri().IsInit()) BinaryDumpInFile(aFp,anObj.NameOri().Val());
}
cElXMLTree * ToXMLTree(const cEtatPims & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"EtatPims",eXMLBranche);
if (anObj.NameOri().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NameOri"),anObj.NameOri().Val())->ReTagThis("NameOri"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cEtatPims & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameOri(),aTree->Get("NameOri",1)); //tototo
}
std::string Mangling( cEtatPims *) {return "7B0598A0C7013DBDFDBF";};
std::list< std::string > & cListOfName::Name()
{
return mName;
}
const std::list< std::string > & cListOfName::Name()const
{
return mName;
}
void BinaryUnDumpFromFile(cListOfName & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Name().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cListOfName & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.Name().size());
for( std::list< std::string >::const_iterator iT=anObj.Name().begin();
iT!=anObj.Name().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cListOfName & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ListOfName",eXMLBranche);
for
( std::list< std::string >::const_iterator it=anObj.Name().begin();
it !=anObj.Name().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Name"),(*it))->ReTagThis("Name"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cListOfName & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Name(),aTree->GetAll("Name",false,1));
}
std::string Mangling( cListOfName *) {return "989865F5644C6DB3FCBF";};
std::string & cModLin::NameIm()
{
return mNameIm;
}
const std::string & cModLin::NameIm()const
{
return mNameIm;
}
double & cModLin::a()
{
return ma;
}
const double & cModLin::a()const
{
return ma;
}
double & cModLin::b()
{
return mb;
}
const double & cModLin::b()const
{
return mb;
}
void BinaryUnDumpFromFile(cModLin & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.NameIm(),aFp);
BinaryUnDumpFromFile(anObj.a(),aFp);
BinaryUnDumpFromFile(anObj.b(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cModLin & anObj)
{
BinaryDumpInFile(aFp,anObj.NameIm());
BinaryDumpInFile(aFp,anObj.a());
BinaryDumpInFile(aFp,anObj.b());
}
cElXMLTree * ToXMLTree(const cModLin & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ModLin",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("NameIm"),anObj.NameIm())->ReTagThis("NameIm"));
aRes->AddFils(::ToXMLTree(std::string("a"),anObj.a())->ReTagThis("a"));
aRes->AddFils(::ToXMLTree(std::string("b"),anObj.b())->ReTagThis("b"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cModLin & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameIm(),aTree->Get("NameIm",1)); //tototo
xml_init(anObj.a(),aTree->Get("a",1)); //tototo
xml_init(anObj.b(),aTree->Get("b",1)); //tototo
}
std::string Mangling( cModLin *) {return "882BD284E3B151FCFDBF";};
std::list< cModLin > & cListOfRadiomEgalModel::ModLin()
{
return mModLin;
}
const std::list< cModLin > & cListOfRadiomEgalModel::ModLin()const
{
return mModLin;
}
void BinaryUnDumpFromFile(cListOfRadiomEgalModel & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cModLin aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ModLin().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cListOfRadiomEgalModel & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.ModLin().size());
for( std::list< cModLin >::const_iterator iT=anObj.ModLin().begin();
iT!=anObj.ModLin().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cListOfRadiomEgalModel & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ListOfRadiomEgalModel",eXMLBranche);
for
( std::list< cModLin >::const_iterator it=anObj.ModLin().begin();
it !=anObj.ModLin().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("ModLin"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cListOfRadiomEgalModel & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.ModLin(),aTree->GetAll("ModLin",false,1));
}
std::string Mangling( cListOfRadiomEgalModel *) {return "9823CB9929CC8097FF3F";};
cTplValGesInit< bool > & cSetNameDescriptor::AddDirCur()
{
return mAddDirCur;
}
const cTplValGesInit< bool > & cSetNameDescriptor::AddDirCur()const
{
return mAddDirCur;
}
std::list< std::string > & cSetNameDescriptor::PatternAccepteur()
{
return mPatternAccepteur;
}
const std::list< std::string > & cSetNameDescriptor::PatternAccepteur()const
{
return mPatternAccepteur;
}
std::list< std::string > & cSetNameDescriptor::PatternRefuteur()
{
return mPatternRefuteur;
}
const std::list< std::string > & cSetNameDescriptor::PatternRefuteur()const
{
return mPatternRefuteur;
}
cTplValGesInit< int > & cSetNameDescriptor::NivSubDir()
{
return mNivSubDir;
}
const cTplValGesInit< int > & cSetNameDescriptor::NivSubDir()const
{
return mNivSubDir;
}
cTplValGesInit< bool > & cSetNameDescriptor::NameCompl()
{
return mNameCompl;
}
const cTplValGesInit< bool > & cSetNameDescriptor::NameCompl()const
{
return mNameCompl;
}
cTplValGesInit< std::string > & cSetNameDescriptor::SubDir()
{
return mSubDir;
}
const cTplValGesInit< std::string > & cSetNameDescriptor::SubDir()const
{
return mSubDir;
}
std::list< std::string > & cSetNameDescriptor::Name()
{
return mName;
}
const std::list< std::string > & cSetNameDescriptor::Name()const
{
return mName;
}
std::list< std::string > & cSetNameDescriptor::NamesFileLON()
{
return mNamesFileLON;
}
const std::list< std::string > & cSetNameDescriptor::NamesFileLON()const
{
return mNamesFileLON;
}
cTplValGesInit< std::string > & cSetNameDescriptor::Min()
{
return mMin;
}
const cTplValGesInit< std::string > & cSetNameDescriptor::Min()const
{
return mMin;
}
cTplValGesInit< std::string > & cSetNameDescriptor::Max()
{
return mMax;
}
const cTplValGesInit< std::string > & cSetNameDescriptor::Max()const
{
return mMax;
}
cTplValGesInit< cNameFilter > & cSetNameDescriptor::Filter()
{
return mFilter;
}
const cTplValGesInit< cNameFilter > & cSetNameDescriptor::Filter()const
{
return mFilter;
}
void BinaryUnDumpFromFile(cSetNameDescriptor & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.AddDirCur().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.AddDirCur().ValForcedForUnUmp(),aFp);
}
else anObj.AddDirCur().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.PatternAccepteur().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.PatternRefuteur().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NivSubDir().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NivSubDir().ValForcedForUnUmp(),aFp);
}
else anObj.NivSubDir().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NameCompl().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NameCompl().ValForcedForUnUmp(),aFp);
}
else anObj.NameCompl().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.SubDir().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.SubDir().ValForcedForUnUmp(),aFp);
}
else anObj.SubDir().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Name().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.NamesFileLON().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Min().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Min().ValForcedForUnUmp(),aFp);
}
else anObj.Min().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Max().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Max().ValForcedForUnUmp(),aFp);
}
else anObj.Max().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Filter().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Filter().ValForcedForUnUmp(),aFp);
}
else anObj.Filter().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cSetNameDescriptor & anObj)
{
BinaryDumpInFile(aFp,anObj.AddDirCur().IsInit());
if (anObj.AddDirCur().IsInit()) BinaryDumpInFile(aFp,anObj.AddDirCur().Val());
BinaryDumpInFile(aFp,(int)anObj.PatternAccepteur().size());
for( std::list< std::string >::const_iterator iT=anObj.PatternAccepteur().begin();
iT!=anObj.PatternAccepteur().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.PatternRefuteur().size());
for( std::list< std::string >::const_iterator iT=anObj.PatternRefuteur().begin();
iT!=anObj.PatternRefuteur().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.NivSubDir().IsInit());
if (anObj.NivSubDir().IsInit()) BinaryDumpInFile(aFp,anObj.NivSubDir().Val());
BinaryDumpInFile(aFp,anObj.NameCompl().IsInit());
if (anObj.NameCompl().IsInit()) BinaryDumpInFile(aFp,anObj.NameCompl().Val());
BinaryDumpInFile(aFp,anObj.SubDir().IsInit());
if (anObj.SubDir().IsInit()) BinaryDumpInFile(aFp,anObj.SubDir().Val());
BinaryDumpInFile(aFp,(int)anObj.Name().size());
for( std::list< std::string >::const_iterator iT=anObj.Name().begin();
iT!=anObj.Name().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.NamesFileLON().size());
for( std::list< std::string >::const_iterator iT=anObj.NamesFileLON().begin();
iT!=anObj.NamesFileLON().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.Min().IsInit());
if (anObj.Min().IsInit()) BinaryDumpInFile(aFp,anObj.Min().Val());
BinaryDumpInFile(aFp,anObj.Max().IsInit());
if (anObj.Max().IsInit()) BinaryDumpInFile(aFp,anObj.Max().Val());
BinaryDumpInFile(aFp,anObj.Filter().IsInit());
if (anObj.Filter().IsInit()) BinaryDumpInFile(aFp,anObj.Filter().Val());
}
cElXMLTree * ToXMLTree(const cSetNameDescriptor & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"SetNameDescriptor",eXMLBranche);
if (anObj.AddDirCur().IsInit())
aRes->AddFils(::ToXMLTree(std::string("AddDirCur"),anObj.AddDirCur().Val())->ReTagThis("AddDirCur"));
for
( std::list< std::string >::const_iterator it=anObj.PatternAccepteur().begin();
it !=anObj.PatternAccepteur().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("PatternAccepteur"),(*it))->ReTagThis("PatternAccepteur"));
for
( std::list< std::string >::const_iterator it=anObj.PatternRefuteur().begin();
it !=anObj.PatternRefuteur().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("PatternRefuteur"),(*it))->ReTagThis("PatternRefuteur"));
if (anObj.NivSubDir().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NivSubDir"),anObj.NivSubDir().Val())->ReTagThis("NivSubDir"));
if (anObj.NameCompl().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NameCompl"),anObj.NameCompl().Val())->ReTagThis("NameCompl"));
if (anObj.SubDir().IsInit())
aRes->AddFils(::ToXMLTree(std::string("SubDir"),anObj.SubDir().Val())->ReTagThis("SubDir"));
for
( std::list< std::string >::const_iterator it=anObj.Name().begin();
it !=anObj.Name().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Name"),(*it))->ReTagThis("Name"));
for
( std::list< std::string >::const_iterator it=anObj.NamesFileLON().begin();
it !=anObj.NamesFileLON().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("NamesFileLON"),(*it))->ReTagThis("NamesFileLON"));
if (anObj.Min().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Min"),anObj.Min().Val())->ReTagThis("Min"));
if (anObj.Max().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Max"),anObj.Max().Val())->ReTagThis("Max"));
if (anObj.Filter().IsInit())
aRes->AddFils(ToXMLTree(anObj.Filter().Val())->ReTagThis("Filter"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cSetNameDescriptor & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.AddDirCur(),aTree->Get("AddDirCur",1),bool(true)); //tototo
xml_init(anObj.PatternAccepteur(),aTree->GetAll("PatternAccepteur",false,1));
xml_init(anObj.PatternRefuteur(),aTree->GetAll("PatternRefuteur",false,1));
xml_init(anObj.NivSubDir(),aTree->Get("NivSubDir",1),int(1)); //tototo
xml_init(anObj.NameCompl(),aTree->Get("NameCompl",1),bool(false)); //tototo
xml_init(anObj.SubDir(),aTree->Get("SubDir",1),std::string("")); //tototo
xml_init(anObj.Name(),aTree->GetAll("Name",false,1));
xml_init(anObj.NamesFileLON(),aTree->GetAll("NamesFileLON",false,1));
xml_init(anObj.Min(),aTree->Get("Min",1)); //tototo
xml_init(anObj.Max(),aTree->Get("Max",1)); //tototo
xml_init(anObj.Filter(),aTree->Get("Filter",1)); //tototo
}
std::string Mangling( cSetNameDescriptor *) {return "8A44F18E9AAD869FFC3F";};
std::string & cImMatrixStructuration::KeySet()
{
return mKeySet;
}
const std::string & cImMatrixStructuration::KeySet()const
{
return mKeySet;
}
Pt2di & cImMatrixStructuration::Period()
{
return mPeriod;
}
const Pt2di & cImMatrixStructuration::Period()const
{
return mPeriod;
}
bool & cImMatrixStructuration::XCroissants()
{
return mXCroissants;
}
const bool & cImMatrixStructuration::XCroissants()const
{
return mXCroissants;
}
bool & cImMatrixStructuration::YCroissants()
{
return mYCroissants;
}
const bool & cImMatrixStructuration::YCroissants()const
{
return mYCroissants;
}
bool & cImMatrixStructuration::XVarieFirst()
{
return mXVarieFirst;
}
const bool & cImMatrixStructuration::XVarieFirst()const
{
return mXVarieFirst;
}
void BinaryUnDumpFromFile(cImMatrixStructuration & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.KeySet(),aFp);
BinaryUnDumpFromFile(anObj.Period(),aFp);
BinaryUnDumpFromFile(anObj.XCroissants(),aFp);
BinaryUnDumpFromFile(anObj.YCroissants(),aFp);
BinaryUnDumpFromFile(anObj.XVarieFirst(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cImMatrixStructuration & anObj)
{
BinaryDumpInFile(aFp,anObj.KeySet());
BinaryDumpInFile(aFp,anObj.Period());
BinaryDumpInFile(aFp,anObj.XCroissants());
BinaryDumpInFile(aFp,anObj.YCroissants());
BinaryDumpInFile(aFp,anObj.XVarieFirst());
}
cElXMLTree * ToXMLTree(const cImMatrixStructuration & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ImMatrixStructuration",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("KeySet"),anObj.KeySet())->ReTagThis("KeySet"));
aRes->AddFils(::ToXMLTree(std::string("Period"),anObj.Period())->ReTagThis("Period"));
aRes->AddFils(::ToXMLTree(std::string("XCroissants"),anObj.XCroissants())->ReTagThis("XCroissants"));
aRes->AddFils(::ToXMLTree(std::string("YCroissants"),anObj.YCroissants())->ReTagThis("YCroissants"));
aRes->AddFils(::ToXMLTree(std::string("XVarieFirst"),anObj.XVarieFirst())->ReTagThis("XVarieFirst"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cImMatrixStructuration & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeySet(),aTree->Get("KeySet",1)); //tototo
xml_init(anObj.Period(),aTree->Get("Period",1)); //tototo
xml_init(anObj.XCroissants(),aTree->Get("XCroissants",1)); //tototo
xml_init(anObj.YCroissants(),aTree->Get("YCroissants",1)); //tototo
xml_init(anObj.XVarieFirst(),aTree->Get("XVarieFirst",1)); //tototo
}
std::string Mangling( cImMatrixStructuration *) {return "70A3ECEE0DE6B78CFD3F";};
std::string & cFiltreEmprise::KeyOri()
{
return mKeyOri;
}
const std::string & cFiltreEmprise::KeyOri()const
{
return mKeyOri;
}
double & cFiltreEmprise::RatioMin()
{
return mRatioMin;
}
const double & cFiltreEmprise::RatioMin()const
{
return mRatioMin;
}
cTplValGesInit< bool > & cFiltreEmprise::MemoFile()
{
return mMemoFile;
}
const cTplValGesInit< bool > & cFiltreEmprise::MemoFile()const
{
return mMemoFile;
}
cTplValGesInit< std::string > & cFiltreEmprise::Tag()
{
return mTag;
}
const cTplValGesInit< std::string > & cFiltreEmprise::Tag()const
{
return mTag;
}
void BinaryUnDumpFromFile(cFiltreEmprise & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.KeyOri(),aFp);
BinaryUnDumpFromFile(anObj.RatioMin(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.MemoFile().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.MemoFile().ValForcedForUnUmp(),aFp);
}
else anObj.MemoFile().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Tag().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Tag().ValForcedForUnUmp(),aFp);
}
else anObj.Tag().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cFiltreEmprise & anObj)
{
BinaryDumpInFile(aFp,anObj.KeyOri());
BinaryDumpInFile(aFp,anObj.RatioMin());
BinaryDumpInFile(aFp,anObj.MemoFile().IsInit());
if (anObj.MemoFile().IsInit()) BinaryDumpInFile(aFp,anObj.MemoFile().Val());
BinaryDumpInFile(aFp,anObj.Tag().IsInit());
if (anObj.Tag().IsInit()) BinaryDumpInFile(aFp,anObj.Tag().Val());
}
cElXMLTree * ToXMLTree(const cFiltreEmprise & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"FiltreEmprise",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("KeyOri"),anObj.KeyOri())->ReTagThis("KeyOri"));
aRes->AddFils(::ToXMLTree(std::string("RatioMin"),anObj.RatioMin())->ReTagThis("RatioMin"));
if (anObj.MemoFile().IsInit())
aRes->AddFils(::ToXMLTree(std::string("MemoFile"),anObj.MemoFile().Val())->ReTagThis("MemoFile"));
if (anObj.Tag().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Tag"),anObj.Tag().Val())->ReTagThis("Tag"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cFiltreEmprise & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeyOri(),aTree->Get("KeyOri",1)); //tototo
xml_init(anObj.RatioMin(),aTree->Get("RatioMin",1)); //tototo
xml_init(anObj.MemoFile(),aTree->Get("MemoFile",1),bool(true)); //tototo
xml_init(anObj.Tag(),aTree->Get("Tag",1),std::string("OrientationConique")); //tototo
}
std::string Mangling( cFiltreEmprise *) {return "192FD52BB5C10085FF3F";};
std::string & cFiltreByRelSsEch::KeySet()
{
return mKeySet;
}
const std::string & cFiltreByRelSsEch::KeySet()const
{
return mKeySet;
}
std::string & cFiltreByRelSsEch::KeyAssocCple()
{
return mKeyAssocCple;
}
const std::string & cFiltreByRelSsEch::KeyAssocCple()const
{
return mKeyAssocCple;
}
IntSubst & cFiltreByRelSsEch::SeuilBasNbPts()
{
return mSeuilBasNbPts;
}
const IntSubst & cFiltreByRelSsEch::SeuilBasNbPts()const
{
return mSeuilBasNbPts;
}
IntSubst & cFiltreByRelSsEch::SeuilHautNbPts()
{
return mSeuilHautNbPts;
}
const IntSubst & cFiltreByRelSsEch::SeuilHautNbPts()const
{
return mSeuilHautNbPts;
}
IntSubst & cFiltreByRelSsEch::NbMinCple()
{
return mNbMinCple;
}
const IntSubst & cFiltreByRelSsEch::NbMinCple()const
{
return mNbMinCple;
}
void BinaryUnDumpFromFile(cFiltreByRelSsEch & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.KeySet(),aFp);
BinaryUnDumpFromFile(anObj.KeyAssocCple(),aFp);
BinaryUnDumpFromFile(anObj.SeuilBasNbPts(),aFp);
BinaryUnDumpFromFile(anObj.SeuilHautNbPts(),aFp);
BinaryUnDumpFromFile(anObj.NbMinCple(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cFiltreByRelSsEch & anObj)
{
BinaryDumpInFile(aFp,anObj.KeySet());
BinaryDumpInFile(aFp,anObj.KeyAssocCple());
BinaryDumpInFile(aFp,anObj.SeuilBasNbPts());
BinaryDumpInFile(aFp,anObj.SeuilHautNbPts());
BinaryDumpInFile(aFp,anObj.NbMinCple());
}
cElXMLTree * ToXMLTree(const cFiltreByRelSsEch & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"FiltreByRelSsEch",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("KeySet"),anObj.KeySet())->ReTagThis("KeySet"));
aRes->AddFils(::ToXMLTree(std::string("KeyAssocCple"),anObj.KeyAssocCple())->ReTagThis("KeyAssocCple"));
aRes->AddFils(::ToXMLTree(std::string("SeuilBasNbPts"),anObj.SeuilBasNbPts())->ReTagThis("SeuilBasNbPts"));
aRes->AddFils(::ToXMLTree(std::string("SeuilHautNbPts"),anObj.SeuilHautNbPts())->ReTagThis("SeuilHautNbPts"));
aRes->AddFils(::ToXMLTree(std::string("NbMinCple"),anObj.NbMinCple())->ReTagThis("NbMinCple"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cFiltreByRelSsEch & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeySet(),aTree->Get("KeySet",1)); //tototo
xml_init(anObj.KeyAssocCple(),aTree->Get("KeyAssocCple",1)); //tototo
xml_init(anObj.SeuilBasNbPts(),aTree->Get("SeuilBasNbPts",1)); //tototo
xml_init(anObj.SeuilHautNbPts(),aTree->Get("SeuilHautNbPts",1)); //tototo
xml_init(anObj.NbMinCple(),aTree->Get("NbMinCple",1)); //tototo
}
std::string Mangling( cFiltreByRelSsEch *) {return "14C6E1727AFFEFA1FE3F";};
cTplValGesInit< std::string > & cFiltreDeRelationOrient::KeyEquiv()
{
return mKeyEquiv;
}
const cTplValGesInit< std::string > & cFiltreDeRelationOrient::KeyEquiv()const
{
return mKeyEquiv;
}
std::string & cFiltreDeRelationOrient::KeyOri()
{
return FiltreEmprise().Val().KeyOri();
}
const std::string & cFiltreDeRelationOrient::KeyOri()const
{
return FiltreEmprise().Val().KeyOri();
}
double & cFiltreDeRelationOrient::RatioMin()
{
return FiltreEmprise().Val().RatioMin();
}
const double & cFiltreDeRelationOrient::RatioMin()const
{
return FiltreEmprise().Val().RatioMin();
}
cTplValGesInit< bool > & cFiltreDeRelationOrient::MemoFile()
{
return FiltreEmprise().Val().MemoFile();
}
const cTplValGesInit< bool > & cFiltreDeRelationOrient::MemoFile()const
{
return FiltreEmprise().Val().MemoFile();
}
cTplValGesInit< std::string > & cFiltreDeRelationOrient::Tag()
{
return FiltreEmprise().Val().Tag();
}
const cTplValGesInit< std::string > & cFiltreDeRelationOrient::Tag()const
{
return FiltreEmprise().Val().Tag();
}
cTplValGesInit< cFiltreEmprise > & cFiltreDeRelationOrient::FiltreEmprise()
{
return mFiltreEmprise;
}
const cTplValGesInit< cFiltreEmprise > & cFiltreDeRelationOrient::FiltreEmprise()const
{
return mFiltreEmprise;
}
cTplValGesInit< std::string > & cFiltreDeRelationOrient::FiltreAdjMatrix()
{
return mFiltreAdjMatrix;
}
const cTplValGesInit< std::string > & cFiltreDeRelationOrient::FiltreAdjMatrix()const
{
return mFiltreAdjMatrix;
}
cTplValGesInit< Pt2di > & cFiltreDeRelationOrient::EcartFiltreMatr()
{
return mEcartFiltreMatr;
}
const cTplValGesInit< Pt2di > & cFiltreDeRelationOrient::EcartFiltreMatr()const
{
return mEcartFiltreMatr;
}
std::string & cFiltreDeRelationOrient::KeySet()
{
return FiltreByRelSsEch().Val().KeySet();
}
const std::string & cFiltreDeRelationOrient::KeySet()const
{
return FiltreByRelSsEch().Val().KeySet();
}
std::string & cFiltreDeRelationOrient::KeyAssocCple()
{
return FiltreByRelSsEch().Val().KeyAssocCple();
}
const std::string & cFiltreDeRelationOrient::KeyAssocCple()const
{
return FiltreByRelSsEch().Val().KeyAssocCple();
}
IntSubst & cFiltreDeRelationOrient::SeuilBasNbPts()
{
return FiltreByRelSsEch().Val().SeuilBasNbPts();
}
const IntSubst & cFiltreDeRelationOrient::SeuilBasNbPts()const
{
return FiltreByRelSsEch().Val().SeuilBasNbPts();
}
IntSubst & cFiltreDeRelationOrient::SeuilHautNbPts()
{
return FiltreByRelSsEch().Val().SeuilHautNbPts();
}
const IntSubst & cFiltreDeRelationOrient::SeuilHautNbPts()const
{
return FiltreByRelSsEch().Val().SeuilHautNbPts();
}
IntSubst & cFiltreDeRelationOrient::NbMinCple()
{
return FiltreByRelSsEch().Val().NbMinCple();
}
const IntSubst & cFiltreDeRelationOrient::NbMinCple()const
{
return FiltreByRelSsEch().Val().NbMinCple();
}
cTplValGesInit< cFiltreByRelSsEch > & cFiltreDeRelationOrient::FiltreByRelSsEch()
{
return mFiltreByRelSsEch;
}
const cTplValGesInit< cFiltreByRelSsEch > & cFiltreDeRelationOrient::FiltreByRelSsEch()const
{
return mFiltreByRelSsEch;
}
void BinaryUnDumpFromFile(cFiltreDeRelationOrient & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.KeyEquiv().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.KeyEquiv().ValForcedForUnUmp(),aFp);
}
else anObj.KeyEquiv().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.FiltreEmprise().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.FiltreEmprise().ValForcedForUnUmp(),aFp);
}
else anObj.FiltreEmprise().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.FiltreAdjMatrix().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.FiltreAdjMatrix().ValForcedForUnUmp(),aFp);
}
else anObj.FiltreAdjMatrix().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.EcartFiltreMatr().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.EcartFiltreMatr().ValForcedForUnUmp(),aFp);
}
else anObj.EcartFiltreMatr().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.FiltreByRelSsEch().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.FiltreByRelSsEch().ValForcedForUnUmp(),aFp);
}
else anObj.FiltreByRelSsEch().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cFiltreDeRelationOrient & anObj)
{
BinaryDumpInFile(aFp,anObj.KeyEquiv().IsInit());
if (anObj.KeyEquiv().IsInit()) BinaryDumpInFile(aFp,anObj.KeyEquiv().Val());
BinaryDumpInFile(aFp,anObj.FiltreEmprise().IsInit());
if (anObj.FiltreEmprise().IsInit()) BinaryDumpInFile(aFp,anObj.FiltreEmprise().Val());
BinaryDumpInFile(aFp,anObj.FiltreAdjMatrix().IsInit());
if (anObj.FiltreAdjMatrix().IsInit()) BinaryDumpInFile(aFp,anObj.FiltreAdjMatrix().Val());
BinaryDumpInFile(aFp,anObj.EcartFiltreMatr().IsInit());
if (anObj.EcartFiltreMatr().IsInit()) BinaryDumpInFile(aFp,anObj.EcartFiltreMatr().Val());
BinaryDumpInFile(aFp,anObj.FiltreByRelSsEch().IsInit());
if (anObj.FiltreByRelSsEch().IsInit()) BinaryDumpInFile(aFp,anObj.FiltreByRelSsEch().Val());
}
cElXMLTree * ToXMLTree(const cFiltreDeRelationOrient & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"FiltreDeRelationOrient",eXMLBranche);
if (anObj.KeyEquiv().IsInit())
aRes->AddFils(::ToXMLTree(std::string("KeyEquiv"),anObj.KeyEquiv().Val())->ReTagThis("KeyEquiv"));
if (anObj.FiltreEmprise().IsInit())
aRes->AddFils(ToXMLTree(anObj.FiltreEmprise().Val())->ReTagThis("FiltreEmprise"));
if (anObj.FiltreAdjMatrix().IsInit())
aRes->AddFils(::ToXMLTree(std::string("FiltreAdjMatrix"),anObj.FiltreAdjMatrix().Val())->ReTagThis("FiltreAdjMatrix"));
if (anObj.EcartFiltreMatr().IsInit())
aRes->AddFils(::ToXMLTree(std::string("EcartFiltreMatr"),anObj.EcartFiltreMatr().Val())->ReTagThis("EcartFiltreMatr"));
if (anObj.FiltreByRelSsEch().IsInit())
aRes->AddFils(ToXMLTree(anObj.FiltreByRelSsEch().Val())->ReTagThis("FiltreByRelSsEch"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cFiltreDeRelationOrient & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeyEquiv(),aTree->Get("KeyEquiv",1)); //tototo
xml_init(anObj.FiltreEmprise(),aTree->Get("FiltreEmprise",1)); //tototo
xml_init(anObj.FiltreAdjMatrix(),aTree->Get("FiltreAdjMatrix",1)); //tototo
xml_init(anObj.EcartFiltreMatr(),aTree->Get("EcartFiltreMatr",1),Pt2di(1,1)); //tototo
xml_init(anObj.FiltreByRelSsEch(),aTree->Get("FiltreByRelSsEch",1)); //tototo
}
std::string Mangling( cFiltreDeRelationOrient *) {return "9A2EDB33175707DAFDBF";};
std::vector< cCpleString > & cSauvegardeNamedRel::Cple()
{
return mCple;
}
const std::vector< cCpleString > & cSauvegardeNamedRel::Cple()const
{
return mCple;
}
void BinaryUnDumpFromFile(cSauvegardeNamedRel & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cCpleString aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Cple().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cSauvegardeNamedRel & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.Cple().size());
for( std::vector< cCpleString >::const_iterator iT=anObj.Cple().begin();
iT!=anObj.Cple().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cSauvegardeNamedRel & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"SauvegardeNamedRel",eXMLBranche);
for
( std::vector< cCpleString >::const_iterator it=anObj.Cple().begin();
it !=anObj.Cple().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Cple"),(*it))->ReTagThis("Cple"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cSauvegardeNamedRel & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Cple(),aTree->GetAll("Cple",false,1));
}
std::string Mangling( cSauvegardeNamedRel *) {return "987C7A7998C3B99FFB3F";};
std::list< std::string > & cSauvegardeSetString::Name()
{
return mName;
}
const std::list< std::string > & cSauvegardeSetString::Name()const
{
return mName;
}
void BinaryUnDumpFromFile(cSauvegardeSetString & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Name().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cSauvegardeSetString & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.Name().size());
for( std::list< std::string >::const_iterator iT=anObj.Name().begin();
iT!=anObj.Name().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cSauvegardeSetString & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"SauvegardeSetString",eXMLBranche);
for
( std::list< std::string >::const_iterator it=anObj.Name().begin();
it !=anObj.Name().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Name"),(*it))->ReTagThis("Name"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cSauvegardeSetString & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Name(),aTree->GetAll("Name",false,1));
}
std::string Mangling( cSauvegardeSetString *) {return "901BB088A58C2CCEFABF";};
std::string & cClassEquivDescripteur::KeySet()
{
return mKeySet;
}
const std::string & cClassEquivDescripteur::KeySet()const
{
return mKeySet;
}
std::string & cClassEquivDescripteur::KeyAssocRep()
{
return mKeyAssocRep;
}
const std::string & cClassEquivDescripteur::KeyAssocRep()const
{
return mKeyAssocRep;
}
std::string & cClassEquivDescripteur::KeyClass()
{
return mKeyClass;
}
const std::string & cClassEquivDescripteur::KeyClass()const
{
return mKeyClass;
}
void BinaryUnDumpFromFile(cClassEquivDescripteur & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.KeySet(),aFp);
BinaryUnDumpFromFile(anObj.KeyAssocRep(),aFp);
BinaryUnDumpFromFile(anObj.KeyClass(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cClassEquivDescripteur & anObj)
{
BinaryDumpInFile(aFp,anObj.KeySet());
BinaryDumpInFile(aFp,anObj.KeyAssocRep());
BinaryDumpInFile(aFp,anObj.KeyClass());
}
cElXMLTree * ToXMLTree(const cClassEquivDescripteur & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ClassEquivDescripteur",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("KeySet"),anObj.KeySet())->ReTagThis("KeySet"));
aRes->AddFils(::ToXMLTree(std::string("KeyAssocRep"),anObj.KeyAssocRep())->ReTagThis("KeyAssocRep"));
aRes->AddFils(::ToXMLTree(std::string("KeyClass"),anObj.KeyClass())->ReTagThis("KeyClass"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cClassEquivDescripteur & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeySet(),aTree->Get("KeySet",1)); //tototo
xml_init(anObj.KeyAssocRep(),aTree->Get("KeyAssocRep",1)); //tototo
xml_init(anObj.KeyClass(),aTree->Get("KeyClass",1)); //tototo
}
std::string Mangling( cClassEquivDescripteur *) {return "1F11AF7EF1FDBAE1FE3F";};
std::vector<std::string> & cOneSpecDelta::Soms()
{
return mSoms;
}
const std::vector<std::string> & cOneSpecDelta::Soms()const
{
return mSoms;
}
std::vector<int> & cOneSpecDelta::Delta()
{
return mDelta;
}
const std::vector<int> & cOneSpecDelta::Delta()const
{
return mDelta;
}
void BinaryUnDumpFromFile(cOneSpecDelta & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Soms(),aFp);
BinaryUnDumpFromFile(anObj.Delta(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cOneSpecDelta & anObj)
{
BinaryDumpInFile(aFp,anObj.Soms());
BinaryDumpInFile(aFp,anObj.Delta());
}
cElXMLTree * ToXMLTree(const cOneSpecDelta & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"OneSpecDelta",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Soms"),anObj.Soms())->ReTagThis("Soms"));
aRes->AddFils(::ToXMLTree(std::string("Delta"),anObj.Delta())->ReTagThis("Delta"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cOneSpecDelta & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Soms(),aTree->Get("Soms",1)); //tototo
xml_init(anObj.Delta(),aTree->Get("Delta",1)); //tototo
}
std::string Mangling( cOneSpecDelta *) {return "C00EE64508F9FF88F8BF";};
std::string & cGrByDelta::KeySet()
{
return mKeySet;
}
const std::string & cGrByDelta::KeySet()const
{
return mKeySet;
}
std::list< cOneSpecDelta > & cGrByDelta::OneSpecDelta()
{
return mOneSpecDelta;
}
const std::list< cOneSpecDelta > & cGrByDelta::OneSpecDelta()const
{
return mOneSpecDelta;
}
void BinaryUnDumpFromFile(cGrByDelta & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.KeySet(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cOneSpecDelta aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.OneSpecDelta().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cGrByDelta & anObj)
{
BinaryDumpInFile(aFp,anObj.KeySet());
BinaryDumpInFile(aFp,(int)anObj.OneSpecDelta().size());
for( std::list< cOneSpecDelta >::const_iterator iT=anObj.OneSpecDelta().begin();
iT!=anObj.OneSpecDelta().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cGrByDelta & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"GrByDelta",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("KeySet"),anObj.KeySet())->ReTagThis("KeySet"));
for
( std::list< cOneSpecDelta >::const_iterator it=anObj.OneSpecDelta().begin();
it !=anObj.OneSpecDelta().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("OneSpecDelta"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cGrByDelta & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeySet(),aTree->Get("KeySet",1)); //tototo
xml_init(anObj.OneSpecDelta(),aTree->GetAll("OneSpecDelta",false,1));
}
std::string Mangling( cGrByDelta *) {return "8041796FAC7C68DCF93F";};
std::list< cCpleString > & cRelByGrapheExpl::Cples()
{
return mCples;
}
const std::list< cCpleString > & cRelByGrapheExpl::Cples()const
{
return mCples;
}
std::list< std::vector<std::string> > & cRelByGrapheExpl::CpleSymWithFirt()
{
return mCpleSymWithFirt;
}
const std::list< std::vector<std::string> > & cRelByGrapheExpl::CpleSymWithFirt()const
{
return mCpleSymWithFirt;
}
std::list< std::vector<std::string> > & cRelByGrapheExpl::ProdCartesien()
{
return mProdCartesien;
}
const std::list< std::vector<std::string> > & cRelByGrapheExpl::ProdCartesien()const
{
return mProdCartesien;
}
cTplValGesInit< std::string > & cRelByGrapheExpl::Prefix2Name()
{
return mPrefix2Name;
}
const cTplValGesInit< std::string > & cRelByGrapheExpl::Prefix2Name()const
{
return mPrefix2Name;
}
cTplValGesInit< std::string > & cRelByGrapheExpl::Postfix2Name()
{
return mPostfix2Name;
}
const cTplValGesInit< std::string > & cRelByGrapheExpl::Postfix2Name()const
{
return mPostfix2Name;
}
std::list< cGrByDelta > & cRelByGrapheExpl::GrByDelta()
{
return mGrByDelta;
}
const std::list< cGrByDelta > & cRelByGrapheExpl::GrByDelta()const
{
return mGrByDelta;
}
void BinaryUnDumpFromFile(cRelByGrapheExpl & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cCpleString aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Cples().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::vector<std::string> aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.CpleSymWithFirt().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::vector<std::string> aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ProdCartesien().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Prefix2Name().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Prefix2Name().ValForcedForUnUmp(),aFp);
}
else anObj.Prefix2Name().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Postfix2Name().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Postfix2Name().ValForcedForUnUmp(),aFp);
}
else anObj.Postfix2Name().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cGrByDelta aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.GrByDelta().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cRelByGrapheExpl & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.Cples().size());
for( std::list< cCpleString >::const_iterator iT=anObj.Cples().begin();
iT!=anObj.Cples().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.CpleSymWithFirt().size());
for( std::list< std::vector<std::string> >::const_iterator iT=anObj.CpleSymWithFirt().begin();
iT!=anObj.CpleSymWithFirt().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.ProdCartesien().size());
for( std::list< std::vector<std::string> >::const_iterator iT=anObj.ProdCartesien().begin();
iT!=anObj.ProdCartesien().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.Prefix2Name().IsInit());
if (anObj.Prefix2Name().IsInit()) BinaryDumpInFile(aFp,anObj.Prefix2Name().Val());
BinaryDumpInFile(aFp,anObj.Postfix2Name().IsInit());
if (anObj.Postfix2Name().IsInit()) BinaryDumpInFile(aFp,anObj.Postfix2Name().Val());
BinaryDumpInFile(aFp,(int)anObj.GrByDelta().size());
for( std::list< cGrByDelta >::const_iterator iT=anObj.GrByDelta().begin();
iT!=anObj.GrByDelta().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cRelByGrapheExpl & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"RelByGrapheExpl",eXMLBranche);
for
( std::list< cCpleString >::const_iterator it=anObj.Cples().begin();
it !=anObj.Cples().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Cples"),(*it))->ReTagThis("Cples"));
for
( std::list< std::vector<std::string> >::const_iterator it=anObj.CpleSymWithFirt().begin();
it !=anObj.CpleSymWithFirt().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("CpleSymWithFirt"),(*it))->ReTagThis("CpleSymWithFirt"));
for
( std::list< std::vector<std::string> >::const_iterator it=anObj.ProdCartesien().begin();
it !=anObj.ProdCartesien().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("ProdCartesien"),(*it))->ReTagThis("ProdCartesien"));
if (anObj.Prefix2Name().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Prefix2Name"),anObj.Prefix2Name().Val())->ReTagThis("Prefix2Name"));
if (anObj.Postfix2Name().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Postfix2Name"),anObj.Postfix2Name().Val())->ReTagThis("Postfix2Name"));
for
( std::list< cGrByDelta >::const_iterator it=anObj.GrByDelta().begin();
it !=anObj.GrByDelta().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("GrByDelta"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cRelByGrapheExpl & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Cples(),aTree->GetAll("Cples",false,1));
xml_init(anObj.CpleSymWithFirt(),aTree->GetAll("CpleSymWithFirt",false,1));
xml_init(anObj.ProdCartesien(),aTree->GetAll("ProdCartesien",false,1));
xml_init(anObj.Prefix2Name(),aTree->Get("Prefix2Name",1)); //tototo
xml_init(anObj.Postfix2Name(),aTree->Get("Postfix2Name",1)); //tototo
xml_init(anObj.GrByDelta(),aTree->GetAll("GrByDelta",false,1));
}
std::string Mangling( cRelByGrapheExpl *) {return "56DF2D953E59E2C5FE3F";};
std::vector< std::string > & cByAdjDeGroupes::KeySets()
{
return mKeySets;
}
const std::vector< std::string > & cByAdjDeGroupes::KeySets()const
{
return mKeySets;
}
int & cByAdjDeGroupes::DeltaMin()
{
return mDeltaMin;
}
const int & cByAdjDeGroupes::DeltaMin()const
{
return mDeltaMin;
}
int & cByAdjDeGroupes::DeltaMax()
{
return mDeltaMax;
}
const int & cByAdjDeGroupes::DeltaMax()const
{
return mDeltaMax;
}
void BinaryUnDumpFromFile(cByAdjDeGroupes & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.KeySets().push_back(aVal);
}
} ;
BinaryUnDumpFromFile(anObj.DeltaMin(),aFp);
BinaryUnDumpFromFile(anObj.DeltaMax(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cByAdjDeGroupes & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.KeySets().size());
for( std::vector< std::string >::const_iterator iT=anObj.KeySets().begin();
iT!=anObj.KeySets().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.DeltaMin());
BinaryDumpInFile(aFp,anObj.DeltaMax());
}
cElXMLTree * ToXMLTree(const cByAdjDeGroupes & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ByAdjDeGroupes",eXMLBranche);
for
( std::vector< std::string >::const_iterator it=anObj.KeySets().begin();
it !=anObj.KeySets().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("KeySets"),(*it))->ReTagThis("KeySets"));
aRes->AddFils(::ToXMLTree(std::string("DeltaMin"),anObj.DeltaMin())->ReTagThis("DeltaMin"));
aRes->AddFils(::ToXMLTree(std::string("DeltaMax"),anObj.DeltaMax())->ReTagThis("DeltaMax"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cByAdjDeGroupes & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeySets(),aTree->GetAll("KeySets",false,1));
xml_init(anObj.DeltaMin(),aTree->Get("DeltaMin",1)); //tototo
xml_init(anObj.DeltaMax(),aTree->Get("DeltaMax",1)); //tototo
}
std::string Mangling( cByAdjDeGroupes *) {return "274C13F0435BCDBEFF3F";};
std::list< cCpleString > & cByGroupesDImages::CplesKey()
{
return mCplesKey;
}
const std::list< cCpleString > & cByGroupesDImages::CplesKey()const
{
return mCplesKey;
}
std::list< cByAdjDeGroupes > & cByGroupesDImages::ByAdjDeGroupes()
{
return mByAdjDeGroupes;
}
const std::list< cByAdjDeGroupes > & cByGroupesDImages::ByAdjDeGroupes()const
{
return mByAdjDeGroupes;
}
cTplValGesInit< cFiltreDeRelationOrient > & cByGroupesDImages::Filtre()
{
return mFiltre;
}
const cTplValGesInit< cFiltreDeRelationOrient > & cByGroupesDImages::Filtre()const
{
return mFiltre;
}
cTplValGesInit< bool > & cByGroupesDImages::Sym()
{
return mSym;
}
const cTplValGesInit< bool > & cByGroupesDImages::Sym()const
{
return mSym;
}
cTplValGesInit< bool > & cByGroupesDImages::Reflexif()
{
return mReflexif;
}
const cTplValGesInit< bool > & cByGroupesDImages::Reflexif()const
{
return mReflexif;
}
void BinaryUnDumpFromFile(cByGroupesDImages & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cCpleString aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.CplesKey().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cByAdjDeGroupes aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ByAdjDeGroupes().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Filtre().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Filtre().ValForcedForUnUmp(),aFp);
}
else anObj.Filtre().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Sym().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Sym().ValForcedForUnUmp(),aFp);
}
else anObj.Sym().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Reflexif().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Reflexif().ValForcedForUnUmp(),aFp);
}
else anObj.Reflexif().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cByGroupesDImages & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.CplesKey().size());
for( std::list< cCpleString >::const_iterator iT=anObj.CplesKey().begin();
iT!=anObj.CplesKey().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.ByAdjDeGroupes().size());
for( std::list< cByAdjDeGroupes >::const_iterator iT=anObj.ByAdjDeGroupes().begin();
iT!=anObj.ByAdjDeGroupes().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.Filtre().IsInit());
if (anObj.Filtre().IsInit()) BinaryDumpInFile(aFp,anObj.Filtre().Val());
BinaryDumpInFile(aFp,anObj.Sym().IsInit());
if (anObj.Sym().IsInit()) BinaryDumpInFile(aFp,anObj.Sym().Val());
BinaryDumpInFile(aFp,anObj.Reflexif().IsInit());
if (anObj.Reflexif().IsInit()) BinaryDumpInFile(aFp,anObj.Reflexif().Val());
}
cElXMLTree * ToXMLTree(const cByGroupesDImages & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ByGroupesDImages",eXMLBranche);
for
( std::list< cCpleString >::const_iterator it=anObj.CplesKey().begin();
it !=anObj.CplesKey().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("CplesKey"),(*it))->ReTagThis("CplesKey"));
for
( std::list< cByAdjDeGroupes >::const_iterator it=anObj.ByAdjDeGroupes().begin();
it !=anObj.ByAdjDeGroupes().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("ByAdjDeGroupes"));
if (anObj.Filtre().IsInit())
aRes->AddFils(ToXMLTree(anObj.Filtre().Val())->ReTagThis("Filtre"));
if (anObj.Sym().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Sym"),anObj.Sym().Val())->ReTagThis("Sym"));
if (anObj.Reflexif().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Reflexif"),anObj.Reflexif().Val())->ReTagThis("Reflexif"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cByGroupesDImages & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.CplesKey(),aTree->GetAll("CplesKey",false,1));
xml_init(anObj.ByAdjDeGroupes(),aTree->GetAll("ByAdjDeGroupes",false,1));
xml_init(anObj.Filtre(),aTree->Get("Filtre",1)); //tototo
xml_init(anObj.Sym(),aTree->Get("Sym",1),bool(true)); //tototo
xml_init(anObj.Reflexif(),aTree->Get("Reflexif",1),bool(false)); //tototo
}
std::string Mangling( cByGroupesDImages *) {return "608932C7B599E392FF3F";};
cTplValGesInit< double > & cFiltreDelaunay::DMaxDelaunay()
{
return mDMaxDelaunay;
}
const cTplValGesInit< double > & cFiltreDelaunay::DMaxDelaunay()const
{
return mDMaxDelaunay;
}
void BinaryUnDumpFromFile(cFiltreDelaunay & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.DMaxDelaunay().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.DMaxDelaunay().ValForcedForUnUmp(),aFp);
}
else anObj.DMaxDelaunay().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cFiltreDelaunay & anObj)
{
BinaryDumpInFile(aFp,anObj.DMaxDelaunay().IsInit());
if (anObj.DMaxDelaunay().IsInit()) BinaryDumpInFile(aFp,anObj.DMaxDelaunay().Val());
}
cElXMLTree * ToXMLTree(const cFiltreDelaunay & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"FiltreDelaunay",eXMLBranche);
if (anObj.DMaxDelaunay().IsInit())
aRes->AddFils(::ToXMLTree(std::string("DMaxDelaunay"),anObj.DMaxDelaunay().Val())->ReTagThis("DMaxDelaunay"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cFiltreDelaunay & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.DMaxDelaunay(),aTree->Get("DMaxDelaunay",1),double(1e9)); //tototo
}
std::string Mangling( cFiltreDelaunay *) {return "929750EB790DE990FDBF";};
double & cFiltreDist::DistMax()
{
return mDistMax;
}
const double & cFiltreDist::DistMax()const
{
return mDistMax;
}
void BinaryUnDumpFromFile(cFiltreDist & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.DistMax(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cFiltreDist & anObj)
{
BinaryDumpInFile(aFp,anObj.DistMax());
}
cElXMLTree * ToXMLTree(const cFiltreDist & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"FiltreDist",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("DistMax"),anObj.DistMax())->ReTagThis("DistMax"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cFiltreDist & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.DistMax(),aTree->Get("DistMax",1)); //tototo
}
std::string Mangling( cFiltreDist *) {return "6084B177BBF432A1FF3F";};
cTplValGesInit< double > & cModeFiltreSpatial::DMaxDelaunay()
{
return FiltreDelaunay().Val().DMaxDelaunay();
}
const cTplValGesInit< double > & cModeFiltreSpatial::DMaxDelaunay()const
{
return FiltreDelaunay().Val().DMaxDelaunay();
}
cTplValGesInit< cFiltreDelaunay > & cModeFiltreSpatial::FiltreDelaunay()
{
return mFiltreDelaunay;
}
const cTplValGesInit< cFiltreDelaunay > & cModeFiltreSpatial::FiltreDelaunay()const
{
return mFiltreDelaunay;
}
double & cModeFiltreSpatial::DistMax()
{
return FiltreDist().Val().DistMax();
}
const double & cModeFiltreSpatial::DistMax()const
{
return FiltreDist().Val().DistMax();
}
cTplValGesInit< cFiltreDist > & cModeFiltreSpatial::FiltreDist()
{
return mFiltreDist;
}
const cTplValGesInit< cFiltreDist > & cModeFiltreSpatial::FiltreDist()const
{
return mFiltreDist;
}
void BinaryUnDumpFromFile(cModeFiltreSpatial & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.FiltreDelaunay().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.FiltreDelaunay().ValForcedForUnUmp(),aFp);
}
else anObj.FiltreDelaunay().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.FiltreDist().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.FiltreDist().ValForcedForUnUmp(),aFp);
}
else anObj.FiltreDist().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cModeFiltreSpatial & anObj)
{
BinaryDumpInFile(aFp,anObj.FiltreDelaunay().IsInit());
if (anObj.FiltreDelaunay().IsInit()) BinaryDumpInFile(aFp,anObj.FiltreDelaunay().Val());
BinaryDumpInFile(aFp,anObj.FiltreDist().IsInit());
if (anObj.FiltreDist().IsInit()) BinaryDumpInFile(aFp,anObj.FiltreDist().Val());
}
cElXMLTree * ToXMLTree(const cModeFiltreSpatial & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ModeFiltreSpatial",eXMLBranche);
if (anObj.FiltreDelaunay().IsInit())
aRes->AddFils(ToXMLTree(anObj.FiltreDelaunay().Val())->ReTagThis("FiltreDelaunay"));
if (anObj.FiltreDist().IsInit())
aRes->AddFils(ToXMLTree(anObj.FiltreDist().Val())->ReTagThis("FiltreDist"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cModeFiltreSpatial & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.FiltreDelaunay(),aTree->Get("FiltreDelaunay",1)); //tototo
xml_init(anObj.FiltreDist(),aTree->Get("FiltreDist",1)); //tototo
}
std::string Mangling( cModeFiltreSpatial *) {return "47C740F30CAB3FDAFE3F";};
cTplValGesInit< std::string > & cByFiltreSpatial::ByFileTrajecto()
{
return mByFileTrajecto;
}
const cTplValGesInit< std::string > & cByFiltreSpatial::ByFileTrajecto()const
{
return mByFileTrajecto;
}
std::string & cByFiltreSpatial::KeyOri()
{
return mKeyOri;
}
const std::string & cByFiltreSpatial::KeyOri()const
{
return mKeyOri;
}
std::string & cByFiltreSpatial::KeySet()
{
return mKeySet;
}
const std::string & cByFiltreSpatial::KeySet()const
{
return mKeySet;
}
cTplValGesInit< std::string > & cByFiltreSpatial::TagCentre()
{
return mTagCentre;
}
const cTplValGesInit< std::string > & cByFiltreSpatial::TagCentre()const
{
return mTagCentre;
}
cTplValGesInit< bool > & cByFiltreSpatial::Sym()
{
return mSym;
}
const cTplValGesInit< bool > & cByFiltreSpatial::Sym()const
{
return mSym;
}
cTplValGesInit< cFiltreDeRelationOrient > & cByFiltreSpatial::FiltreSup()
{
return mFiltreSup;
}
const cTplValGesInit< cFiltreDeRelationOrient > & cByFiltreSpatial::FiltreSup()const
{
return mFiltreSup;
}
cTplValGesInit< double > & cByFiltreSpatial::DMaxDelaunay()
{
return ModeFiltreSpatial().FiltreDelaunay().Val().DMaxDelaunay();
}
const cTplValGesInit< double > & cByFiltreSpatial::DMaxDelaunay()const
{
return ModeFiltreSpatial().FiltreDelaunay().Val().DMaxDelaunay();
}
cTplValGesInit< cFiltreDelaunay > & cByFiltreSpatial::FiltreDelaunay()
{
return ModeFiltreSpatial().FiltreDelaunay();
}
const cTplValGesInit< cFiltreDelaunay > & cByFiltreSpatial::FiltreDelaunay()const
{
return ModeFiltreSpatial().FiltreDelaunay();
}
double & cByFiltreSpatial::DistMax()
{
return ModeFiltreSpatial().FiltreDist().Val().DistMax();
}
const double & cByFiltreSpatial::DistMax()const
{
return ModeFiltreSpatial().FiltreDist().Val().DistMax();
}
cTplValGesInit< cFiltreDist > & cByFiltreSpatial::FiltreDist()
{
return ModeFiltreSpatial().FiltreDist();
}
const cTplValGesInit< cFiltreDist > & cByFiltreSpatial::FiltreDist()const
{
return ModeFiltreSpatial().FiltreDist();
}
cModeFiltreSpatial & cByFiltreSpatial::ModeFiltreSpatial()
{
return mModeFiltreSpatial;
}
const cModeFiltreSpatial & cByFiltreSpatial::ModeFiltreSpatial()const
{
return mModeFiltreSpatial;
}
void BinaryUnDumpFromFile(cByFiltreSpatial & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ByFileTrajecto().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ByFileTrajecto().ValForcedForUnUmp(),aFp);
}
else anObj.ByFileTrajecto().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.KeyOri(),aFp);
BinaryUnDumpFromFile(anObj.KeySet(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.TagCentre().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.TagCentre().ValForcedForUnUmp(),aFp);
}
else anObj.TagCentre().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Sym().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Sym().ValForcedForUnUmp(),aFp);
}
else anObj.Sym().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.FiltreSup().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.FiltreSup().ValForcedForUnUmp(),aFp);
}
else anObj.FiltreSup().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.ModeFiltreSpatial(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cByFiltreSpatial & anObj)
{
BinaryDumpInFile(aFp,anObj.ByFileTrajecto().IsInit());
if (anObj.ByFileTrajecto().IsInit()) BinaryDumpInFile(aFp,anObj.ByFileTrajecto().Val());
BinaryDumpInFile(aFp,anObj.KeyOri());
BinaryDumpInFile(aFp,anObj.KeySet());
BinaryDumpInFile(aFp,anObj.TagCentre().IsInit());
if (anObj.TagCentre().IsInit()) BinaryDumpInFile(aFp,anObj.TagCentre().Val());
BinaryDumpInFile(aFp,anObj.Sym().IsInit());
if (anObj.Sym().IsInit()) BinaryDumpInFile(aFp,anObj.Sym().Val());
BinaryDumpInFile(aFp,anObj.FiltreSup().IsInit());
if (anObj.FiltreSup().IsInit()) BinaryDumpInFile(aFp,anObj.FiltreSup().Val());
BinaryDumpInFile(aFp,anObj.ModeFiltreSpatial());
}
cElXMLTree * ToXMLTree(const cByFiltreSpatial & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ByFiltreSpatial",eXMLBranche);
if (anObj.ByFileTrajecto().IsInit())
aRes->AddFils(::ToXMLTree(std::string("ByFileTrajecto"),anObj.ByFileTrajecto().Val())->ReTagThis("ByFileTrajecto"));
aRes->AddFils(::ToXMLTree(std::string("KeyOri"),anObj.KeyOri())->ReTagThis("KeyOri"));
aRes->AddFils(::ToXMLTree(std::string("KeySet"),anObj.KeySet())->ReTagThis("KeySet"));
if (anObj.TagCentre().IsInit())
aRes->AddFils(::ToXMLTree(std::string("TagCentre"),anObj.TagCentre().Val())->ReTagThis("TagCentre"));
if (anObj.Sym().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Sym"),anObj.Sym().Val())->ReTagThis("Sym"));
if (anObj.FiltreSup().IsInit())
aRes->AddFils(ToXMLTree(anObj.FiltreSup().Val())->ReTagThis("FiltreSup"));
aRes->AddFils(ToXMLTree(anObj.ModeFiltreSpatial())->ReTagThis("ModeFiltreSpatial"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cByFiltreSpatial & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.ByFileTrajecto(),aTree->Get("ByFileTrajecto",1)); //tototo
xml_init(anObj.KeyOri(),aTree->Get("KeyOri",1)); //tototo
xml_init(anObj.KeySet(),aTree->Get("KeySet",1)); //tototo
xml_init(anObj.TagCentre(),aTree->Get("TagCentre",1),std::string("Centre")); //tototo
xml_init(anObj.Sym(),aTree->Get("Sym",1),bool(true)); //tototo
xml_init(anObj.FiltreSup(),aTree->Get("FiltreSup",1)); //tototo
xml_init(anObj.ModeFiltreSpatial(),aTree->Get("ModeFiltreSpatial",1)); //tototo
}
std::string Mangling( cByFiltreSpatial *) {return "06BF958EE3AB278EFE3F";};
std::vector< std::string > & cByAdjacence::KeySets()
{
return mKeySets;
}
const std::vector< std::string > & cByAdjacence::KeySets()const
{
return mKeySets;
}
cTplValGesInit< IntSubst > & cByAdjacence::DeltaMax()
{
return mDeltaMax;
}
const cTplValGesInit< IntSubst > & cByAdjacence::DeltaMax()const
{
return mDeltaMax;
}
cTplValGesInit< IntSubst > & cByAdjacence::DeltaMin()
{
return mDeltaMin;
}
const cTplValGesInit< IntSubst > & cByAdjacence::DeltaMin()const
{
return mDeltaMin;
}
cTplValGesInit< IntSubst > & cByAdjacence::Sampling()
{
return mSampling;
}
const cTplValGesInit< IntSubst > & cByAdjacence::Sampling()const
{
return mSampling;
}
cTplValGesInit< cFiltreDeRelationOrient > & cByAdjacence::Filtre()
{
return mFiltre;
}
const cTplValGesInit< cFiltreDeRelationOrient > & cByAdjacence::Filtre()const
{
return mFiltre;
}
cTplValGesInit< bool > & cByAdjacence::Sym()
{
return mSym;
}
const cTplValGesInit< bool > & cByAdjacence::Sym()const
{
return mSym;
}
cTplValGesInit< BoolSubst > & cByAdjacence::Circ()
{
return mCirc;
}
const cTplValGesInit< BoolSubst > & cByAdjacence::Circ()const
{
return mCirc;
}
void BinaryUnDumpFromFile(cByAdjacence & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.KeySets().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.DeltaMax().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.DeltaMax().ValForcedForUnUmp(),aFp);
}
else anObj.DeltaMax().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.DeltaMin().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.DeltaMin().ValForcedForUnUmp(),aFp);
}
else anObj.DeltaMin().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Sampling().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Sampling().ValForcedForUnUmp(),aFp);
}
else anObj.Sampling().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Filtre().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Filtre().ValForcedForUnUmp(),aFp);
}
else anObj.Filtre().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Sym().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Sym().ValForcedForUnUmp(),aFp);
}
else anObj.Sym().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Circ().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Circ().ValForcedForUnUmp(),aFp);
}
else anObj.Circ().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cByAdjacence & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.KeySets().size());
for( std::vector< std::string >::const_iterator iT=anObj.KeySets().begin();
iT!=anObj.KeySets().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.DeltaMax().IsInit());
if (anObj.DeltaMax().IsInit()) BinaryDumpInFile(aFp,anObj.DeltaMax().Val());
BinaryDumpInFile(aFp,anObj.DeltaMin().IsInit());
if (anObj.DeltaMin().IsInit()) BinaryDumpInFile(aFp,anObj.DeltaMin().Val());
BinaryDumpInFile(aFp,anObj.Sampling().IsInit());
if (anObj.Sampling().IsInit()) BinaryDumpInFile(aFp,anObj.Sampling().Val());
BinaryDumpInFile(aFp,anObj.Filtre().IsInit());
if (anObj.Filtre().IsInit()) BinaryDumpInFile(aFp,anObj.Filtre().Val());
BinaryDumpInFile(aFp,anObj.Sym().IsInit());
if (anObj.Sym().IsInit()) BinaryDumpInFile(aFp,anObj.Sym().Val());
BinaryDumpInFile(aFp,anObj.Circ().IsInit());
if (anObj.Circ().IsInit()) BinaryDumpInFile(aFp,anObj.Circ().Val());
}
cElXMLTree * ToXMLTree(const cByAdjacence & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ByAdjacence",eXMLBranche);
for
( std::vector< std::string >::const_iterator it=anObj.KeySets().begin();
it !=anObj.KeySets().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("KeySets"),(*it))->ReTagThis("KeySets"));
if (anObj.DeltaMax().IsInit())
aRes->AddFils(::ToXMLTree(std::string("DeltaMax"),anObj.DeltaMax().Val())->ReTagThis("DeltaMax"));
if (anObj.DeltaMin().IsInit())
aRes->AddFils(::ToXMLTree(std::string("DeltaMin"),anObj.DeltaMin().Val())->ReTagThis("DeltaMin"));
if (anObj.Sampling().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Sampling"),anObj.Sampling().Val())->ReTagThis("Sampling"));
if (anObj.Filtre().IsInit())
aRes->AddFils(ToXMLTree(anObj.Filtre().Val())->ReTagThis("Filtre"));
if (anObj.Sym().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Sym"),anObj.Sym().Val())->ReTagThis("Sym"));
if (anObj.Circ().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Circ"),anObj.Circ().Val())->ReTagThis("Circ"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cByAdjacence & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeySets(),aTree->GetAll("KeySets",false,1));
xml_init(anObj.DeltaMax(),aTree->Get("DeltaMax",1),IntSubst(10000000)); //tototo
xml_init(anObj.DeltaMin(),aTree->Get("DeltaMin",1)); //tototo
xml_init(anObj.Sampling(),aTree->Get("Sampling",1)); //tototo
xml_init(anObj.Filtre(),aTree->Get("Filtre",1)); //tototo
xml_init(anObj.Sym(),aTree->Get("Sym",1),bool(true)); //tototo
xml_init(anObj.Circ(),aTree->Get("Circ",1),BoolSubst(false)); //tototo
}
std::string Mangling( cByAdjacence *) {return "647695CB034E6081FD3F";};
std::list< std::string > & cNameRelDescriptor::NameFileIn()
{
return mNameFileIn;
}
const std::list< std::string > & cNameRelDescriptor::NameFileIn()const
{
return mNameFileIn;
}
cTplValGesInit< bool > & cNameRelDescriptor::Reflexif()
{
return mReflexif;
}
const cTplValGesInit< bool > & cNameRelDescriptor::Reflexif()const
{
return mReflexif;
}
cTplValGesInit< std::string > & cNameRelDescriptor::NameFileSauvegarde()
{
return mNameFileSauvegarde;
}
const cTplValGesInit< std::string > & cNameRelDescriptor::NameFileSauvegarde()const
{
return mNameFileSauvegarde;
}
std::list< cRelByGrapheExpl > & cNameRelDescriptor::RelByGrapheExpl()
{
return mRelByGrapheExpl;
}
const std::list< cRelByGrapheExpl > & cNameRelDescriptor::RelByGrapheExpl()const
{
return mRelByGrapheExpl;
}
std::list< cByGroupesDImages > & cNameRelDescriptor::ByGroupesDImages()
{
return mByGroupesDImages;
}
const std::list< cByGroupesDImages > & cNameRelDescriptor::ByGroupesDImages()const
{
return mByGroupesDImages;
}
std::list< cByFiltreSpatial > & cNameRelDescriptor::ByFiltreSpatial()
{
return mByFiltreSpatial;
}
const std::list< cByFiltreSpatial > & cNameRelDescriptor::ByFiltreSpatial()const
{
return mByFiltreSpatial;
}
std::list< cByAdjacence > & cNameRelDescriptor::ByAdjacence()
{
return mByAdjacence;
}
const std::list< cByAdjacence > & cNameRelDescriptor::ByAdjacence()const
{
return mByAdjacence;
}
std::list< cCpleString > & cNameRelDescriptor::CplesExcl()
{
return mCplesExcl;
}
const std::list< cCpleString > & cNameRelDescriptor::CplesExcl()const
{
return mCplesExcl;
}
void BinaryUnDumpFromFile(cNameRelDescriptor & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.NameFileIn().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Reflexif().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Reflexif().ValForcedForUnUmp(),aFp);
}
else anObj.Reflexif().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NameFileSauvegarde().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NameFileSauvegarde().ValForcedForUnUmp(),aFp);
}
else anObj.NameFileSauvegarde().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cRelByGrapheExpl aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.RelByGrapheExpl().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cByGroupesDImages aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ByGroupesDImages().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cByFiltreSpatial aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ByFiltreSpatial().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cByAdjacence aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ByAdjacence().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cCpleString aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.CplesExcl().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cNameRelDescriptor & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.NameFileIn().size());
for( std::list< std::string >::const_iterator iT=anObj.NameFileIn().begin();
iT!=anObj.NameFileIn().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.Reflexif().IsInit());
if (anObj.Reflexif().IsInit()) BinaryDumpInFile(aFp,anObj.Reflexif().Val());
BinaryDumpInFile(aFp,anObj.NameFileSauvegarde().IsInit());
if (anObj.NameFileSauvegarde().IsInit()) BinaryDumpInFile(aFp,anObj.NameFileSauvegarde().Val());
BinaryDumpInFile(aFp,(int)anObj.RelByGrapheExpl().size());
for( std::list< cRelByGrapheExpl >::const_iterator iT=anObj.RelByGrapheExpl().begin();
iT!=anObj.RelByGrapheExpl().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.ByGroupesDImages().size());
for( std::list< cByGroupesDImages >::const_iterator iT=anObj.ByGroupesDImages().begin();
iT!=anObj.ByGroupesDImages().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.ByFiltreSpatial().size());
for( std::list< cByFiltreSpatial >::const_iterator iT=anObj.ByFiltreSpatial().begin();
iT!=anObj.ByFiltreSpatial().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.ByAdjacence().size());
for( std::list< cByAdjacence >::const_iterator iT=anObj.ByAdjacence().begin();
iT!=anObj.ByAdjacence().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.CplesExcl().size());
for( std::list< cCpleString >::const_iterator iT=anObj.CplesExcl().begin();
iT!=anObj.CplesExcl().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cNameRelDescriptor & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"NameRelDescriptor",eXMLBranche);
for
( std::list< std::string >::const_iterator it=anObj.NameFileIn().begin();
it !=anObj.NameFileIn().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("NameFileIn"),(*it))->ReTagThis("NameFileIn"));
if (anObj.Reflexif().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Reflexif"),anObj.Reflexif().Val())->ReTagThis("Reflexif"));
if (anObj.NameFileSauvegarde().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NameFileSauvegarde"),anObj.NameFileSauvegarde().Val())->ReTagThis("NameFileSauvegarde"));
for
( std::list< cRelByGrapheExpl >::const_iterator it=anObj.RelByGrapheExpl().begin();
it !=anObj.RelByGrapheExpl().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("RelByGrapheExpl"));
for
( std::list< cByGroupesDImages >::const_iterator it=anObj.ByGroupesDImages().begin();
it !=anObj.ByGroupesDImages().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("ByGroupesDImages"));
for
( std::list< cByFiltreSpatial >::const_iterator it=anObj.ByFiltreSpatial().begin();
it !=anObj.ByFiltreSpatial().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("ByFiltreSpatial"));
for
( std::list< cByAdjacence >::const_iterator it=anObj.ByAdjacence().begin();
it !=anObj.ByAdjacence().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("ByAdjacence"));
for
( std::list< cCpleString >::const_iterator it=anObj.CplesExcl().begin();
it !=anObj.CplesExcl().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("CplesExcl"),(*it))->ReTagThis("CplesExcl"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cNameRelDescriptor & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameFileIn(),aTree->GetAll("NameFileIn",false,1));
xml_init(anObj.Reflexif(),aTree->Get("Reflexif",1),bool(false)); //tototo
xml_init(anObj.NameFileSauvegarde(),aTree->Get("NameFileSauvegarde",1)); //tototo
xml_init(anObj.RelByGrapheExpl(),aTree->GetAll("RelByGrapheExpl",false,1));
xml_init(anObj.ByGroupesDImages(),aTree->GetAll("ByGroupesDImages",false,1));
xml_init(anObj.ByFiltreSpatial(),aTree->GetAll("ByFiltreSpatial",false,1));
xml_init(anObj.ByAdjacence(),aTree->GetAll("ByAdjacence",false,1));
xml_init(anObj.CplesExcl(),aTree->GetAll("CplesExcl",false,1));
}
std::string Mangling( cNameRelDescriptor *) {return "FC4385429EFB18D9FE3F";};
std::string & cExeRequired::Exe()
{
return mExe;
}
const std::string & cExeRequired::Exe()const
{
return mExe;
}
std::string & cExeRequired::Make()
{
return mMake;
}
const std::string & cExeRequired::Make()const
{
return mMake;
}
void BinaryUnDumpFromFile(cExeRequired & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Exe(),aFp);
BinaryUnDumpFromFile(anObj.Make(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cExeRequired & anObj)
{
BinaryDumpInFile(aFp,anObj.Exe());
BinaryDumpInFile(aFp,anObj.Make());
}
cElXMLTree * ToXMLTree(const cExeRequired & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ExeRequired",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Exe"),anObj.Exe())->ReTagThis("Exe"));
aRes->AddFils(::ToXMLTree(std::string("Make"),anObj.Make())->ReTagThis("Make"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cExeRequired & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Exe(),aTree->Get("Exe",1)); //tototo
xml_init(anObj.Make(),aTree->Get("Make",1)); //tototo
}
std::string Mangling( cExeRequired *) {return "3C1E4B5E8B6442AEFBBF";};
std::list< std::string > & cFileRequired::Pattern()
{
return mPattern;
}
const std::list< std::string > & cFileRequired::Pattern()const
{
return mPattern;
}
cTplValGesInit< int > & cFileRequired::NbMin()
{
return mNbMin;
}
const cTplValGesInit< int > & cFileRequired::NbMin()const
{
return mNbMin;
}
cTplValGesInit< int > & cFileRequired::NbMax()
{
return mNbMax;
}
const cTplValGesInit< int > & cFileRequired::NbMax()const
{
return mNbMax;
}
void BinaryUnDumpFromFile(cFileRequired & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Pattern().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NbMin().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NbMin().ValForcedForUnUmp(),aFp);
}
else anObj.NbMin().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NbMax().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NbMax().ValForcedForUnUmp(),aFp);
}
else anObj.NbMax().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cFileRequired & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.Pattern().size());
for( std::list< std::string >::const_iterator iT=anObj.Pattern().begin();
iT!=anObj.Pattern().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.NbMin().IsInit());
if (anObj.NbMin().IsInit()) BinaryDumpInFile(aFp,anObj.NbMin().Val());
BinaryDumpInFile(aFp,anObj.NbMax().IsInit());
if (anObj.NbMax().IsInit()) BinaryDumpInFile(aFp,anObj.NbMax().Val());
}
cElXMLTree * ToXMLTree(const cFileRequired & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"FileRequired",eXMLBranche);
for
( std::list< std::string >::const_iterator it=anObj.Pattern().begin();
it !=anObj.Pattern().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Pattern"),(*it))->ReTagThis("Pattern"));
if (anObj.NbMin().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NbMin"),anObj.NbMin().Val())->ReTagThis("NbMin"));
if (anObj.NbMax().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NbMax"),anObj.NbMax().Val())->ReTagThis("NbMax"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cFileRequired & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Pattern(),aTree->GetAll("Pattern",false,1));
xml_init(anObj.NbMin(),aTree->Get("NbMin",1),int(1)); //tototo
xml_init(anObj.NbMax(),aTree->Get("NbMax",1)); //tototo
}
std::string Mangling( cFileRequired *) {return "38329C2372040FE1FBBF";};
std::list< cExeRequired > & cBatchRequirement::ExeRequired()
{
return mExeRequired;
}
const std::list< cExeRequired > & cBatchRequirement::ExeRequired()const
{
return mExeRequired;
}
std::list< cFileRequired > & cBatchRequirement::FileRequired()
{
return mFileRequired;
}
const std::list< cFileRequired > & cBatchRequirement::FileRequired()const
{
return mFileRequired;
}
void BinaryUnDumpFromFile(cBatchRequirement & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cExeRequired aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ExeRequired().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cFileRequired aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.FileRequired().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cBatchRequirement & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.ExeRequired().size());
for( std::list< cExeRequired >::const_iterator iT=anObj.ExeRequired().begin();
iT!=anObj.ExeRequired().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.FileRequired().size());
for( std::list< cFileRequired >::const_iterator iT=anObj.FileRequired().begin();
iT!=anObj.FileRequired().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cBatchRequirement & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"BatchRequirement",eXMLBranche);
for
( std::list< cExeRequired >::const_iterator it=anObj.ExeRequired().begin();
it !=anObj.ExeRequired().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("ExeRequired"));
for
( std::list< cFileRequired >::const_iterator it=anObj.FileRequired().begin();
it !=anObj.FileRequired().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("FileRequired"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cBatchRequirement & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.ExeRequired(),aTree->GetAll("ExeRequired",false,1));
xml_init(anObj.FileRequired(),aTree->GetAll("FileRequired",false,1));
}
std::string Mangling( cBatchRequirement *) {return "30C4FCA41488DE8FFCBF";};
cTplValGesInit< Pt3dr > & cExportApero2MM::DirVertLoc()
{
return mDirVertLoc;
}
const cTplValGesInit< Pt3dr > & cExportApero2MM::DirVertLoc()const
{
return mDirVertLoc;
}
cTplValGesInit< double > & cExportApero2MM::ProfInVertLoc()
{
return mProfInVertLoc;
}
const cTplValGesInit< double > & cExportApero2MM::ProfInVertLoc()const
{
return mProfInVertLoc;
}
void BinaryUnDumpFromFile(cExportApero2MM & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.DirVertLoc().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.DirVertLoc().ValForcedForUnUmp(),aFp);
}
else anObj.DirVertLoc().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ProfInVertLoc().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ProfInVertLoc().ValForcedForUnUmp(),aFp);
}
else anObj.ProfInVertLoc().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cExportApero2MM & anObj)
{
BinaryDumpInFile(aFp,anObj.DirVertLoc().IsInit());
if (anObj.DirVertLoc().IsInit()) BinaryDumpInFile(aFp,anObj.DirVertLoc().Val());
BinaryDumpInFile(aFp,anObj.ProfInVertLoc().IsInit());
if (anObj.ProfInVertLoc().IsInit()) BinaryDumpInFile(aFp,anObj.ProfInVertLoc().Val());
}
cElXMLTree * ToXMLTree(const cExportApero2MM & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ExportApero2MM",eXMLBranche);
if (anObj.DirVertLoc().IsInit())
aRes->AddFils(ToXMLTree(std::string("DirVertLoc"),anObj.DirVertLoc().Val())->ReTagThis("DirVertLoc"));
if (anObj.ProfInVertLoc().IsInit())
aRes->AddFils(::ToXMLTree(std::string("ProfInVertLoc"),anObj.ProfInVertLoc().Val())->ReTagThis("ProfInVertLoc"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cExportApero2MM & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.DirVertLoc(),aTree->Get("DirVertLoc",1)); //tototo
xml_init(anObj.ProfInVertLoc(),aTree->Get("ProfInVertLoc",1)); //tototo
}
std::string Mangling( cExportApero2MM *) {return "AF8050D32387CCA1FE3F";};
cTplValGesInit< int > & cXmlXifInfo::HGRev()
{
return mHGRev;
}
const cTplValGesInit< int > & cXmlXifInfo::HGRev()const
{
return mHGRev;
}
cTplValGesInit< std::string > & cXmlXifInfo::GITRev()
{
return mGITRev;
}
const cTplValGesInit< std::string > & cXmlXifInfo::GITRev()const
{
return mGITRev;
}
cTplValGesInit< double > & cXmlXifInfo::FocMM()
{
return mFocMM;
}
const cTplValGesInit< double > & cXmlXifInfo::FocMM()const
{
return mFocMM;
}
cTplValGesInit< double > & cXmlXifInfo::Foc35()
{
return mFoc35;
}
const cTplValGesInit< double > & cXmlXifInfo::Foc35()const
{
return mFoc35;
}
cTplValGesInit< double > & cXmlXifInfo::ExpTime()
{
return mExpTime;
}
const cTplValGesInit< double > & cXmlXifInfo::ExpTime()const
{
return mExpTime;
}
cTplValGesInit< double > & cXmlXifInfo::Diaph()
{
return mDiaph;
}
const cTplValGesInit< double > & cXmlXifInfo::Diaph()const
{
return mDiaph;
}
cTplValGesInit< double > & cXmlXifInfo::IsoSpeed()
{
return mIsoSpeed;
}
const cTplValGesInit< double > & cXmlXifInfo::IsoSpeed()const
{
return mIsoSpeed;
}
cTplValGesInit< Pt2di > & cXmlXifInfo::Sz()
{
return mSz;
}
const cTplValGesInit< Pt2di > & cXmlXifInfo::Sz()const
{
return mSz;
}
cTplValGesInit< double > & cXmlXifInfo::GPSLat()
{
return mGPSLat;
}
const cTplValGesInit< double > & cXmlXifInfo::GPSLat()const
{
return mGPSLat;
}
cTplValGesInit< double > & cXmlXifInfo::GPSLon()
{
return mGPSLon;
}
const cTplValGesInit< double > & cXmlXifInfo::GPSLon()const
{
return mGPSLon;
}
cTplValGesInit< double > & cXmlXifInfo::GPSAlt()
{
return mGPSAlt;
}
const cTplValGesInit< double > & cXmlXifInfo::GPSAlt()const
{
return mGPSAlt;
}
cTplValGesInit< std::string > & cXmlXifInfo::Cam()
{
return mCam;
}
const cTplValGesInit< std::string > & cXmlXifInfo::Cam()const
{
return mCam;
}
cTplValGesInit< std::string > & cXmlXifInfo::BayPat()
{
return mBayPat;
}
const cTplValGesInit< std::string > & cXmlXifInfo::BayPat()const
{
return mBayPat;
}
cTplValGesInit< cXmlDate > & cXmlXifInfo::Date()
{
return mDate;
}
const cTplValGesInit< cXmlDate > & cXmlXifInfo::Date()const
{
return mDate;
}
cTplValGesInit< std::string > & cXmlXifInfo::Orientation()
{
return mOrientation;
}
const cTplValGesInit< std::string > & cXmlXifInfo::Orientation()const
{
return mOrientation;
}
cTplValGesInit< std::string > & cXmlXifInfo::CameraOrientation()
{
return mCameraOrientation;
}
const cTplValGesInit< std::string > & cXmlXifInfo::CameraOrientation()const
{
return mCameraOrientation;
}
cTplValGesInit< int > & cXmlXifInfo::NbBits()
{
return mNbBits;
}
const cTplValGesInit< int > & cXmlXifInfo::NbBits()const
{
return mNbBits;
}
void BinaryUnDumpFromFile(cXmlXifInfo & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.HGRev().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.HGRev().ValForcedForUnUmp(),aFp);
}
else anObj.HGRev().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.GITRev().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.GITRev().ValForcedForUnUmp(),aFp);
}
else anObj.GITRev().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.FocMM().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.FocMM().ValForcedForUnUmp(),aFp);
}
else anObj.FocMM().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Foc35().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Foc35().ValForcedForUnUmp(),aFp);
}
else anObj.Foc35().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ExpTime().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ExpTime().ValForcedForUnUmp(),aFp);
}
else anObj.ExpTime().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Diaph().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Diaph().ValForcedForUnUmp(),aFp);
}
else anObj.Diaph().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.IsoSpeed().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.IsoSpeed().ValForcedForUnUmp(),aFp);
}
else anObj.IsoSpeed().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Sz().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Sz().ValForcedForUnUmp(),aFp);
}
else anObj.Sz().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.GPSLat().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.GPSLat().ValForcedForUnUmp(),aFp);
}
else anObj.GPSLat().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.GPSLon().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.GPSLon().ValForcedForUnUmp(),aFp);
}
else anObj.GPSLon().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.GPSAlt().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.GPSAlt().ValForcedForUnUmp(),aFp);
}
else anObj.GPSAlt().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Cam().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Cam().ValForcedForUnUmp(),aFp);
}
else anObj.Cam().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.BayPat().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.BayPat().ValForcedForUnUmp(),aFp);
}
else anObj.BayPat().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Date().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Date().ValForcedForUnUmp(),aFp);
}
else anObj.Date().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Orientation().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Orientation().ValForcedForUnUmp(),aFp);
}
else anObj.Orientation().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.CameraOrientation().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.CameraOrientation().ValForcedForUnUmp(),aFp);
}
else anObj.CameraOrientation().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NbBits().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NbBits().ValForcedForUnUmp(),aFp);
}
else anObj.NbBits().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlXifInfo & anObj)
{
BinaryDumpInFile(aFp,anObj.HGRev().IsInit());
if (anObj.HGRev().IsInit()) BinaryDumpInFile(aFp,anObj.HGRev().Val());
BinaryDumpInFile(aFp,anObj.GITRev().IsInit());
if (anObj.GITRev().IsInit()) BinaryDumpInFile(aFp,anObj.GITRev().Val());
BinaryDumpInFile(aFp,anObj.FocMM().IsInit());
if (anObj.FocMM().IsInit()) BinaryDumpInFile(aFp,anObj.FocMM().Val());
BinaryDumpInFile(aFp,anObj.Foc35().IsInit());
if (anObj.Foc35().IsInit()) BinaryDumpInFile(aFp,anObj.Foc35().Val());
BinaryDumpInFile(aFp,anObj.ExpTime().IsInit());
if (anObj.ExpTime().IsInit()) BinaryDumpInFile(aFp,anObj.ExpTime().Val());
BinaryDumpInFile(aFp,anObj.Diaph().IsInit());
if (anObj.Diaph().IsInit()) BinaryDumpInFile(aFp,anObj.Diaph().Val());
BinaryDumpInFile(aFp,anObj.IsoSpeed().IsInit());
if (anObj.IsoSpeed().IsInit()) BinaryDumpInFile(aFp,anObj.IsoSpeed().Val());
BinaryDumpInFile(aFp,anObj.Sz().IsInit());
if (anObj.Sz().IsInit()) BinaryDumpInFile(aFp,anObj.Sz().Val());
BinaryDumpInFile(aFp,anObj.GPSLat().IsInit());
if (anObj.GPSLat().IsInit()) BinaryDumpInFile(aFp,anObj.GPSLat().Val());
BinaryDumpInFile(aFp,anObj.GPSLon().IsInit());
if (anObj.GPSLon().IsInit()) BinaryDumpInFile(aFp,anObj.GPSLon().Val());
BinaryDumpInFile(aFp,anObj.GPSAlt().IsInit());
if (anObj.GPSAlt().IsInit()) BinaryDumpInFile(aFp,anObj.GPSAlt().Val());
BinaryDumpInFile(aFp,anObj.Cam().IsInit());
if (anObj.Cam().IsInit()) BinaryDumpInFile(aFp,anObj.Cam().Val());
BinaryDumpInFile(aFp,anObj.BayPat().IsInit());
if (anObj.BayPat().IsInit()) BinaryDumpInFile(aFp,anObj.BayPat().Val());
BinaryDumpInFile(aFp,anObj.Date().IsInit());
if (anObj.Date().IsInit()) BinaryDumpInFile(aFp,anObj.Date().Val());
BinaryDumpInFile(aFp,anObj.Orientation().IsInit());
if (anObj.Orientation().IsInit()) BinaryDumpInFile(aFp,anObj.Orientation().Val());
BinaryDumpInFile(aFp,anObj.CameraOrientation().IsInit());
if (anObj.CameraOrientation().IsInit()) BinaryDumpInFile(aFp,anObj.CameraOrientation().Val());
BinaryDumpInFile(aFp,anObj.NbBits().IsInit());
if (anObj.NbBits().IsInit()) BinaryDumpInFile(aFp,anObj.NbBits().Val());
}
cElXMLTree * ToXMLTree(const cXmlXifInfo & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlXifInfo",eXMLBranche);
if (anObj.HGRev().IsInit())
aRes->AddFils(::ToXMLTree(std::string("HGRev"),anObj.HGRev().Val())->ReTagThis("HGRev"));
if (anObj.GITRev().IsInit())
aRes->AddFils(::ToXMLTree(std::string("GITRev"),anObj.GITRev().Val())->ReTagThis("GITRev"));
if (anObj.FocMM().IsInit())
aRes->AddFils(::ToXMLTree(std::string("FocMM"),anObj.FocMM().Val())->ReTagThis("FocMM"));
if (anObj.Foc35().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Foc35"),anObj.Foc35().Val())->ReTagThis("Foc35"));
if (anObj.ExpTime().IsInit())
aRes->AddFils(::ToXMLTree(std::string("ExpTime"),anObj.ExpTime().Val())->ReTagThis("ExpTime"));
if (anObj.Diaph().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Diaph"),anObj.Diaph().Val())->ReTagThis("Diaph"));
if (anObj.IsoSpeed().IsInit())
aRes->AddFils(::ToXMLTree(std::string("IsoSpeed"),anObj.IsoSpeed().Val())->ReTagThis("IsoSpeed"));
if (anObj.Sz().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Sz"),anObj.Sz().Val())->ReTagThis("Sz"));
if (anObj.GPSLat().IsInit())
aRes->AddFils(::ToXMLTree(std::string("GPSLat"),anObj.GPSLat().Val())->ReTagThis("GPSLat"));
if (anObj.GPSLon().IsInit())
aRes->AddFils(::ToXMLTree(std::string("GPSLon"),anObj.GPSLon().Val())->ReTagThis("GPSLon"));
if (anObj.GPSAlt().IsInit())
aRes->AddFils(::ToXMLTree(std::string("GPSAlt"),anObj.GPSAlt().Val())->ReTagThis("GPSAlt"));
if (anObj.Cam().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Cam"),anObj.Cam().Val())->ReTagThis("Cam"));
if (anObj.BayPat().IsInit())
aRes->AddFils(::ToXMLTree(std::string("BayPat"),anObj.BayPat().Val())->ReTagThis("BayPat"));
if (anObj.Date().IsInit())
aRes->AddFils(ToXMLTree(anObj.Date().Val())->ReTagThis("Date"));
if (anObj.Orientation().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Orientation"),anObj.Orientation().Val())->ReTagThis("Orientation"));
if (anObj.CameraOrientation().IsInit())
aRes->AddFils(::ToXMLTree(std::string("CameraOrientation"),anObj.CameraOrientation().Val())->ReTagThis("CameraOrientation"));
if (anObj.NbBits().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NbBits"),anObj.NbBits().Val())->ReTagThis("NbBits"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlXifInfo & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.HGRev(),aTree->Get("HGRev",1)); //tototo
xml_init(anObj.GITRev(),aTree->Get("GITRev",1)); //tototo
xml_init(anObj.FocMM(),aTree->Get("FocMM",1)); //tototo
xml_init(anObj.Foc35(),aTree->Get("Foc35",1)); //tototo
xml_init(anObj.ExpTime(),aTree->Get("ExpTime",1)); //tototo
xml_init(anObj.Diaph(),aTree->Get("Diaph",1)); //tototo
xml_init(anObj.IsoSpeed(),aTree->Get("IsoSpeed",1)); //tototo
xml_init(anObj.Sz(),aTree->Get("Sz",1)); //tototo
xml_init(anObj.GPSLat(),aTree->Get("GPSLat",1)); //tototo
xml_init(anObj.GPSLon(),aTree->Get("GPSLon",1)); //tototo
xml_init(anObj.GPSAlt(),aTree->Get("GPSAlt",1)); //tototo
xml_init(anObj.Cam(),aTree->Get("Cam",1)); //tototo
xml_init(anObj.BayPat(),aTree->Get("BayPat",1)); //tototo
xml_init(anObj.Date(),aTree->Get("Date",1)); //tototo
xml_init(anObj.Orientation(),aTree->Get("Orientation",1)); //tototo
xml_init(anObj.CameraOrientation(),aTree->Get("CameraOrientation",1)); //tototo
xml_init(anObj.NbBits(),aTree->Get("NbBits",1)); //tototo
}
std::string Mangling( cXmlXifInfo *) {return "64C3CBB5EC6519B3FF3F";};
double & cMIC_IndicAutoCorrel::AutoC()
{
return mAutoC;
}
const double & cMIC_IndicAutoCorrel::AutoC()const
{
return mAutoC;
}
double & cMIC_IndicAutoCorrel::SzCalc()
{
return mSzCalc;
}
const double & cMIC_IndicAutoCorrel::SzCalc()const
{
return mSzCalc;
}
void BinaryUnDumpFromFile(cMIC_IndicAutoCorrel & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.AutoC(),aFp);
BinaryUnDumpFromFile(anObj.SzCalc(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cMIC_IndicAutoCorrel & anObj)
{
BinaryDumpInFile(aFp,anObj.AutoC());
BinaryDumpInFile(aFp,anObj.SzCalc());
}
cElXMLTree * ToXMLTree(const cMIC_IndicAutoCorrel & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"MIC_IndicAutoCorrel",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("AutoC"),anObj.AutoC())->ReTagThis("AutoC"));
aRes->AddFils(::ToXMLTree(std::string("SzCalc"),anObj.SzCalc())->ReTagThis("SzCalc"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cMIC_IndicAutoCorrel & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.AutoC(),aTree->Get("AutoC",1)); //tototo
xml_init(anObj.SzCalc(),aTree->Get("SzCalc",1)); //tototo
}
std::string Mangling( cMIC_IndicAutoCorrel *) {return "E043D9B45BA9E6D5F9BF";};
std::list< cMIC_IndicAutoCorrel > & cMTDImCalc::MIC_IndicAutoCorrel()
{
return mMIC_IndicAutoCorrel;
}
const std::list< cMIC_IndicAutoCorrel > & cMTDImCalc::MIC_IndicAutoCorrel()const
{
return mMIC_IndicAutoCorrel;
}
void BinaryUnDumpFromFile(cMTDImCalc & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cMIC_IndicAutoCorrel aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.MIC_IndicAutoCorrel().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cMTDImCalc & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.MIC_IndicAutoCorrel().size());
for( std::list< cMIC_IndicAutoCorrel >::const_iterator iT=anObj.MIC_IndicAutoCorrel().begin();
iT!=anObj.MIC_IndicAutoCorrel().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cMTDImCalc & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"MTDImCalc",eXMLBranche);
for
( std::list< cMIC_IndicAutoCorrel >::const_iterator it=anObj.MIC_IndicAutoCorrel().begin();
it !=anObj.MIC_IndicAutoCorrel().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("MIC_IndicAutoCorrel"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cMTDImCalc & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.MIC_IndicAutoCorrel(),aTree->GetAll("MIC_IndicAutoCorrel",false,1));
}
std::string Mangling( cMTDImCalc *) {return "5383E738246DEDE8FE3F";};
std::string & cCameraEntry::Name()
{
return mName;
}
const std::string & cCameraEntry::Name()const
{
return mName;
}
Pt2dr & cCameraEntry::SzCaptMm()
{
return mSzCaptMm;
}
const Pt2dr & cCameraEntry::SzCaptMm()const
{
return mSzCaptMm;
}
std::string & cCameraEntry::ShortName()
{
return mShortName;
}
const std::string & cCameraEntry::ShortName()const
{
return mShortName;
}
cTplValGesInit< bool > & cCameraEntry::BayerSwapRB()
{
return mBayerSwapRB;
}
const cTplValGesInit< bool > & cCameraEntry::BayerSwapRB()const
{
return mBayerSwapRB;
}
cTplValGesInit< bool > & cCameraEntry::DevRawBasic()
{
return mDevRawBasic;
}
const cTplValGesInit< bool > & cCameraEntry::DevRawBasic()const
{
return mDevRawBasic;
}
void BinaryUnDumpFromFile(cCameraEntry & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Name(),aFp);
BinaryUnDumpFromFile(anObj.SzCaptMm(),aFp);
BinaryUnDumpFromFile(anObj.ShortName(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.BayerSwapRB().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.BayerSwapRB().ValForcedForUnUmp(),aFp);
}
else anObj.BayerSwapRB().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.DevRawBasic().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.DevRawBasic().ValForcedForUnUmp(),aFp);
}
else anObj.DevRawBasic().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cCameraEntry & anObj)
{
BinaryDumpInFile(aFp,anObj.Name());
BinaryDumpInFile(aFp,anObj.SzCaptMm());
BinaryDumpInFile(aFp,anObj.ShortName());
BinaryDumpInFile(aFp,anObj.BayerSwapRB().IsInit());
if (anObj.BayerSwapRB().IsInit()) BinaryDumpInFile(aFp,anObj.BayerSwapRB().Val());
BinaryDumpInFile(aFp,anObj.DevRawBasic().IsInit());
if (anObj.DevRawBasic().IsInit()) BinaryDumpInFile(aFp,anObj.DevRawBasic().Val());
}
cElXMLTree * ToXMLTree(const cCameraEntry & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"CameraEntry",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Name"),anObj.Name())->ReTagThis("Name"));
aRes->AddFils(::ToXMLTree(std::string("SzCaptMm"),anObj.SzCaptMm())->ReTagThis("SzCaptMm"));
aRes->AddFils(::ToXMLTree(std::string("ShortName"),anObj.ShortName())->ReTagThis("ShortName"));
if (anObj.BayerSwapRB().IsInit())
aRes->AddFils(::ToXMLTree(std::string("BayerSwapRB"),anObj.BayerSwapRB().Val())->ReTagThis("BayerSwapRB"));
if (anObj.DevRawBasic().IsInit())
aRes->AddFils(::ToXMLTree(std::string("DevRawBasic"),anObj.DevRawBasic().Val())->ReTagThis("DevRawBasic"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cCameraEntry & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Name(),aTree->Get("Name",1)); //tototo
xml_init(anObj.SzCaptMm(),aTree->Get("SzCaptMm",1)); //tototo
xml_init(anObj.ShortName(),aTree->Get("ShortName",1)); //tototo
xml_init(anObj.BayerSwapRB(),aTree->Get("BayerSwapRB",1),bool(false)); //tototo
xml_init(anObj.DevRawBasic(),aTree->Get("DevRawBasic",1),bool(false)); //tototo
}
std::string Mangling( cCameraEntry *) {return "A0CB2D914BCE10A2F9BF";};
std::list< cCameraEntry > & cMMCameraDataBase::CameraEntry()
{
return mCameraEntry;
}
const std::list< cCameraEntry > & cMMCameraDataBase::CameraEntry()const
{
return mCameraEntry;
}
void BinaryUnDumpFromFile(cMMCameraDataBase & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cCameraEntry aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.CameraEntry().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cMMCameraDataBase & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.CameraEntry().size());
for( std::list< cCameraEntry >::const_iterator iT=anObj.CameraEntry().begin();
iT!=anObj.CameraEntry().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cMMCameraDataBase & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"MMCameraDataBase",eXMLBranche);
for
( std::list< cCameraEntry >::const_iterator it=anObj.CameraEntry().begin();
it !=anObj.CameraEntry().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("CameraEntry"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cMMCameraDataBase & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.CameraEntry(),aTree->GetAll("CameraEntry",false,1));
}
std::string Mangling( cMMCameraDataBase *) {return "E294F46DDAFEB481FE3F";};
std::string & cMakeDataBase::KeySetCollectXif()
{
return mKeySetCollectXif;
}
const std::string & cMakeDataBase::KeySetCollectXif()const
{
return mKeySetCollectXif;
}
std::list< std::string > & cMakeDataBase::KeyAssocNameSup()
{
return mKeyAssocNameSup;
}
const std::list< std::string > & cMakeDataBase::KeyAssocNameSup()const
{
return mKeyAssocNameSup;
}
cTplValGesInit< std::string > & cMakeDataBase::NameFile()
{
return mNameFile;
}
const cTplValGesInit< std::string > & cMakeDataBase::NameFile()const
{
return mNameFile;
}
void BinaryUnDumpFromFile(cMakeDataBase & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.KeySetCollectXif(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.KeyAssocNameSup().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NameFile().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NameFile().ValForcedForUnUmp(),aFp);
}
else anObj.NameFile().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cMakeDataBase & anObj)
{
BinaryDumpInFile(aFp,anObj.KeySetCollectXif());
BinaryDumpInFile(aFp,(int)anObj.KeyAssocNameSup().size());
for( std::list< std::string >::const_iterator iT=anObj.KeyAssocNameSup().begin();
iT!=anObj.KeyAssocNameSup().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.NameFile().IsInit());
if (anObj.NameFile().IsInit()) BinaryDumpInFile(aFp,anObj.NameFile().Val());
}
cElXMLTree * ToXMLTree(const cMakeDataBase & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"MakeDataBase",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("KeySetCollectXif"),anObj.KeySetCollectXif())->ReTagThis("KeySetCollectXif"));
for
( std::list< std::string >::const_iterator it=anObj.KeyAssocNameSup().begin();
it !=anObj.KeyAssocNameSup().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("KeyAssocNameSup"),(*it))->ReTagThis("KeyAssocNameSup"));
if (anObj.NameFile().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NameFile"),anObj.NameFile().Val())->ReTagThis("NameFile"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cMakeDataBase & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeySetCollectXif(),aTree->Get("KeySetCollectXif",1)); //tototo
xml_init(anObj.KeyAssocNameSup(),aTree->GetAll("KeyAssocNameSup",false,1));
xml_init(anObj.NameFile(),aTree->Get("NameFile",1),std::string("MicMacDataBase")); //tototo
}
std::string Mangling( cMakeDataBase *) {return "E7760627E5B4DAB9FE3F";};
cTplValGesInit< cBatchRequirement > & cBatchChantDesc::Requirement()
{
return mRequirement;
}
const cTplValGesInit< cBatchRequirement > & cBatchChantDesc::Requirement()const
{
return mRequirement;
}
std::string & cBatchChantDesc::Key()
{
return mKey;
}
const std::string & cBatchChantDesc::Key()const
{
return mKey;
}
std::list< std::string > & cBatchChantDesc::Line()
{
return mLine;
}
const std::list< std::string > & cBatchChantDesc::Line()const
{
return mLine;
}
void BinaryUnDumpFromFile(cBatchChantDesc & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Requirement().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Requirement().ValForcedForUnUmp(),aFp);
}
else anObj.Requirement().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.Key(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Line().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cBatchChantDesc & anObj)
{
BinaryDumpInFile(aFp,anObj.Requirement().IsInit());
if (anObj.Requirement().IsInit()) BinaryDumpInFile(aFp,anObj.Requirement().Val());
BinaryDumpInFile(aFp,anObj.Key());
BinaryDumpInFile(aFp,(int)anObj.Line().size());
for( std::list< std::string >::const_iterator iT=anObj.Line().begin();
iT!=anObj.Line().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cBatchChantDesc & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"BatchChantDesc",eXMLBranche);
if (anObj.Requirement().IsInit())
aRes->AddFils(ToXMLTree(anObj.Requirement().Val())->ReTagThis("Requirement"));
aRes->AddFils(::ToXMLTree(std::string("Key"),anObj.Key())->ReTagThis("Key"));
for
( std::list< std::string >::const_iterator it=anObj.Line().begin();
it !=anObj.Line().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Line"),(*it))->ReTagThis("Line"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cBatchChantDesc & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Requirement(),aTree->Get("Requirement",1)); //tototo
xml_init(anObj.Key(),aTree->Get("Key",1)); //tototo
xml_init(anObj.Line(),aTree->GetAll("Line",false,1));
}
std::string Mangling( cBatchChantDesc *) {return "F1C482936B80138CFE3F";};
std::list< std::string > & cOneShowChantDesc::LineBefore()
{
return mLineBefore;
}
const std::list< std::string > & cOneShowChantDesc::LineBefore()const
{
return mLineBefore;
}
cTplValGesInit< bool > & cOneShowChantDesc::ShowKeys()
{
return mShowKeys;
}
const cTplValGesInit< bool > & cOneShowChantDesc::ShowKeys()const
{
return mShowKeys;
}
std::list< std::string > & cOneShowChantDesc::KeyRels()
{
return mKeyRels;
}
const std::list< std::string > & cOneShowChantDesc::KeyRels()const
{
return mKeyRels;
}
std::list< std::string > & cOneShowChantDesc::KeySets()
{
return mKeySets;
}
const std::list< std::string > & cOneShowChantDesc::KeySets()const
{
return mKeySets;
}
std::list< std::string > & cOneShowChantDesc::LineAfter()
{
return mLineAfter;
}
const std::list< std::string > & cOneShowChantDesc::LineAfter()const
{
return mLineAfter;
}
void BinaryUnDumpFromFile(cOneShowChantDesc & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.LineBefore().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ShowKeys().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ShowKeys().ValForcedForUnUmp(),aFp);
}
else anObj.ShowKeys().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.KeyRels().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.KeySets().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.LineAfter().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cOneShowChantDesc & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.LineBefore().size());
for( std::list< std::string >::const_iterator iT=anObj.LineBefore().begin();
iT!=anObj.LineBefore().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.ShowKeys().IsInit());
if (anObj.ShowKeys().IsInit()) BinaryDumpInFile(aFp,anObj.ShowKeys().Val());
BinaryDumpInFile(aFp,(int)anObj.KeyRels().size());
for( std::list< std::string >::const_iterator iT=anObj.KeyRels().begin();
iT!=anObj.KeyRels().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.KeySets().size());
for( std::list< std::string >::const_iterator iT=anObj.KeySets().begin();
iT!=anObj.KeySets().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.LineAfter().size());
for( std::list< std::string >::const_iterator iT=anObj.LineAfter().begin();
iT!=anObj.LineAfter().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cOneShowChantDesc & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"OneShowChantDesc",eXMLBranche);
for
( std::list< std::string >::const_iterator it=anObj.LineBefore().begin();
it !=anObj.LineBefore().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("LineBefore"),(*it))->ReTagThis("LineBefore"));
if (anObj.ShowKeys().IsInit())
aRes->AddFils(::ToXMLTree(std::string("ShowKeys"),anObj.ShowKeys().Val())->ReTagThis("ShowKeys"));
for
( std::list< std::string >::const_iterator it=anObj.KeyRels().begin();
it !=anObj.KeyRels().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("KeyRels"),(*it))->ReTagThis("KeyRels"));
for
( std::list< std::string >::const_iterator it=anObj.KeySets().begin();
it !=anObj.KeySets().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("KeySets"),(*it))->ReTagThis("KeySets"));
for
( std::list< std::string >::const_iterator it=anObj.LineAfter().begin();
it !=anObj.LineAfter().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("LineAfter"),(*it))->ReTagThis("LineAfter"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cOneShowChantDesc & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.LineBefore(),aTree->GetAll("LineBefore",false,1));
xml_init(anObj.ShowKeys(),aTree->Get("ShowKeys",1),bool(true)); //tototo
xml_init(anObj.KeyRels(),aTree->GetAll("KeyRels",false,1));
xml_init(anObj.KeySets(),aTree->GetAll("KeySets",false,1));
xml_init(anObj.LineAfter(),aTree->GetAll("LineAfter",false,1));
}
std::string Mangling( cOneShowChantDesc *) {return "A018A96866DDE481FD3F";};
std::list< cOneShowChantDesc > & cShowChantDesc::OneShowChantDesc()
{
return mOneShowChantDesc;
}
const std::list< cOneShowChantDesc > & cShowChantDesc::OneShowChantDesc()const
{
return mOneShowChantDesc;
}
std::string & cShowChantDesc::File()
{
return mFile;
}
const std::string & cShowChantDesc::File()const
{
return mFile;
}
void BinaryUnDumpFromFile(cShowChantDesc & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cOneShowChantDesc aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.OneShowChantDesc().push_back(aVal);
}
} ;
BinaryUnDumpFromFile(anObj.File(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cShowChantDesc & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.OneShowChantDesc().size());
for( std::list< cOneShowChantDesc >::const_iterator iT=anObj.OneShowChantDesc().begin();
iT!=anObj.OneShowChantDesc().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.File());
}
cElXMLTree * ToXMLTree(const cShowChantDesc & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ShowChantDesc",eXMLBranche);
for
( std::list< cOneShowChantDesc >::const_iterator it=anObj.OneShowChantDesc().begin();
it !=anObj.OneShowChantDesc().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("OneShowChantDesc"));
aRes->AddFils(::ToXMLTree(std::string("File"),anObj.File())->ReTagThis("File"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cShowChantDesc & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.OneShowChantDesc(),aTree->GetAll("OneShowChantDesc",false,1));
xml_init(anObj.File(),aTree->Get("File",1)); //tototo
}
std::string Mangling( cShowChantDesc *) {return "DC4D73F483B6C28BFD3F";};
std::string & cMatrixSplitBox::KeyMatr()
{
return mKeyMatr;
}
const std::string & cMatrixSplitBox::KeyMatr()const
{
return mKeyMatr;
}
cTplValGesInit< double > & cMatrixSplitBox::Rab()
{
return mRab;
}
const cTplValGesInit< double > & cMatrixSplitBox::Rab()const
{
return mRab;
}
void BinaryUnDumpFromFile(cMatrixSplitBox & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.KeyMatr(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Rab().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Rab().ValForcedForUnUmp(),aFp);
}
else anObj.Rab().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cMatrixSplitBox & anObj)
{
BinaryDumpInFile(aFp,anObj.KeyMatr());
BinaryDumpInFile(aFp,anObj.Rab().IsInit());
if (anObj.Rab().IsInit()) BinaryDumpInFile(aFp,anObj.Rab().Val());
}
cElXMLTree * ToXMLTree(const cMatrixSplitBox & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"MatrixSplitBox",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("KeyMatr"),anObj.KeyMatr())->ReTagThis("KeyMatr"));
if (anObj.Rab().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Rab"),anObj.Rab().Val())->ReTagThis("Rab"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cMatrixSplitBox & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeyMatr(),aTree->Get("KeyMatr",1)); //tototo
xml_init(anObj.Rab(),aTree->Get("Rab",1),double(0.0)); //tototo
}
std::string Mangling( cMatrixSplitBox *) {return "222360D231B842D0FE3F";};
cTplValGesInit< std::string > & cContenuAPrioriImage::KeyAutoAdaptScale()
{
return mKeyAutoAdaptScale;
}
const cTplValGesInit< std::string > & cContenuAPrioriImage::KeyAutoAdaptScale()const
{
return mKeyAutoAdaptScale;
}
cTplValGesInit< double > & cContenuAPrioriImage::PdsMaxAdaptScale()
{
return mPdsMaxAdaptScale;
}
const cTplValGesInit< double > & cContenuAPrioriImage::PdsMaxAdaptScale()const
{
return mPdsMaxAdaptScale;
}
cTplValGesInit< double > & cContenuAPrioriImage::Scale()
{
return mScale;
}
const cTplValGesInit< double > & cContenuAPrioriImage::Scale()const
{
return mScale;
}
cTplValGesInit< double > & cContenuAPrioriImage::Teta()
{
return mTeta;
}
const cTplValGesInit< double > & cContenuAPrioriImage::Teta()const
{
return mTeta;
}
cTplValGesInit< Box2di > & cContenuAPrioriImage::BoiteEnglob()
{
return mBoiteEnglob;
}
const cTplValGesInit< Box2di > & cContenuAPrioriImage::BoiteEnglob()const
{
return mBoiteEnglob;
}
cTplValGesInit< std::string > & cContenuAPrioriImage::ElInt_CaPImAddedSet()
{
return mElInt_CaPImAddedSet;
}
const cTplValGesInit< std::string > & cContenuAPrioriImage::ElInt_CaPImAddedSet()const
{
return mElInt_CaPImAddedSet;
}
cTplValGesInit< std::string > & cContenuAPrioriImage::ElInt_CaPImMyKey()
{
return mElInt_CaPImMyKey;
}
const cTplValGesInit< std::string > & cContenuAPrioriImage::ElInt_CaPImMyKey()const
{
return mElInt_CaPImMyKey;
}
std::string & cContenuAPrioriImage::KeyMatr()
{
return MatrixSplitBox().Val().KeyMatr();
}
const std::string & cContenuAPrioriImage::KeyMatr()const
{
return MatrixSplitBox().Val().KeyMatr();
}
cTplValGesInit< double > & cContenuAPrioriImage::Rab()
{
return MatrixSplitBox().Val().Rab();
}
const cTplValGesInit< double > & cContenuAPrioriImage::Rab()const
{
return MatrixSplitBox().Val().Rab();
}
cTplValGesInit< cMatrixSplitBox > & cContenuAPrioriImage::MatrixSplitBox()
{
return mMatrixSplitBox;
}
const cTplValGesInit< cMatrixSplitBox > & cContenuAPrioriImage::MatrixSplitBox()const
{
return mMatrixSplitBox;
}
void BinaryUnDumpFromFile(cContenuAPrioriImage & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.KeyAutoAdaptScale().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.KeyAutoAdaptScale().ValForcedForUnUmp(),aFp);
}
else anObj.KeyAutoAdaptScale().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.PdsMaxAdaptScale().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.PdsMaxAdaptScale().ValForcedForUnUmp(),aFp);
}
else anObj.PdsMaxAdaptScale().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Scale().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Scale().ValForcedForUnUmp(),aFp);
}
else anObj.Scale().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Teta().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Teta().ValForcedForUnUmp(),aFp);
}
else anObj.Teta().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.BoiteEnglob().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.BoiteEnglob().ValForcedForUnUmp(),aFp);
}
else anObj.BoiteEnglob().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ElInt_CaPImAddedSet().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ElInt_CaPImAddedSet().ValForcedForUnUmp(),aFp);
}
else anObj.ElInt_CaPImAddedSet().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ElInt_CaPImMyKey().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ElInt_CaPImMyKey().ValForcedForUnUmp(),aFp);
}
else anObj.ElInt_CaPImMyKey().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.MatrixSplitBox().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.MatrixSplitBox().ValForcedForUnUmp(),aFp);
}
else anObj.MatrixSplitBox().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cContenuAPrioriImage & anObj)
{
BinaryDumpInFile(aFp,anObj.KeyAutoAdaptScale().IsInit());
if (anObj.KeyAutoAdaptScale().IsInit()) BinaryDumpInFile(aFp,anObj.KeyAutoAdaptScale().Val());
BinaryDumpInFile(aFp,anObj.PdsMaxAdaptScale().IsInit());
if (anObj.PdsMaxAdaptScale().IsInit()) BinaryDumpInFile(aFp,anObj.PdsMaxAdaptScale().Val());
BinaryDumpInFile(aFp,anObj.Scale().IsInit());
if (anObj.Scale().IsInit()) BinaryDumpInFile(aFp,anObj.Scale().Val());
BinaryDumpInFile(aFp,anObj.Teta().IsInit());
if (anObj.Teta().IsInit()) BinaryDumpInFile(aFp,anObj.Teta().Val());
BinaryDumpInFile(aFp,anObj.BoiteEnglob().IsInit());
if (anObj.BoiteEnglob().IsInit()) BinaryDumpInFile(aFp,anObj.BoiteEnglob().Val());
BinaryDumpInFile(aFp,anObj.ElInt_CaPImAddedSet().IsInit());
if (anObj.ElInt_CaPImAddedSet().IsInit()) BinaryDumpInFile(aFp,anObj.ElInt_CaPImAddedSet().Val());
BinaryDumpInFile(aFp,anObj.ElInt_CaPImMyKey().IsInit());
if (anObj.ElInt_CaPImMyKey().IsInit()) BinaryDumpInFile(aFp,anObj.ElInt_CaPImMyKey().Val());
BinaryDumpInFile(aFp,anObj.MatrixSplitBox().IsInit());
if (anObj.MatrixSplitBox().IsInit()) BinaryDumpInFile(aFp,anObj.MatrixSplitBox().Val());
}
cElXMLTree * ToXMLTree(const cContenuAPrioriImage & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ContenuAPrioriImage",eXMLBranche);
if (anObj.KeyAutoAdaptScale().IsInit())
aRes->AddFils(::ToXMLTree(std::string("KeyAutoAdaptScale"),anObj.KeyAutoAdaptScale().Val())->ReTagThis("KeyAutoAdaptScale"));
if (anObj.PdsMaxAdaptScale().IsInit())
aRes->AddFils(::ToXMLTree(std::string("PdsMaxAdaptScale"),anObj.PdsMaxAdaptScale().Val())->ReTagThis("PdsMaxAdaptScale"));
if (anObj.Scale().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Scale"),anObj.Scale().Val())->ReTagThis("Scale"));
if (anObj.Teta().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Teta"),anObj.Teta().Val())->ReTagThis("Teta"));
if (anObj.BoiteEnglob().IsInit())
aRes->AddFils(::ToXMLTree(std::string("BoiteEnglob"),anObj.BoiteEnglob().Val())->ReTagThis("BoiteEnglob"));
if (anObj.ElInt_CaPImAddedSet().IsInit())
aRes->AddFils(::ToXMLTree(std::string("ElInt_CaPImAddedSet"),anObj.ElInt_CaPImAddedSet().Val())->ReTagThis("ElInt_CaPImAddedSet"));
if (anObj.ElInt_CaPImMyKey().IsInit())
aRes->AddFils(::ToXMLTree(std::string("ElInt_CaPImMyKey"),anObj.ElInt_CaPImMyKey().Val())->ReTagThis("ElInt_CaPImMyKey"));
if (anObj.MatrixSplitBox().IsInit())
aRes->AddFils(ToXMLTree(anObj.MatrixSplitBox().Val())->ReTagThis("MatrixSplitBox"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cContenuAPrioriImage & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeyAutoAdaptScale(),aTree->Get("KeyAutoAdaptScale",1)); //tototo
xml_init(anObj.PdsMaxAdaptScale(),aTree->Get("PdsMaxAdaptScale",1),double(0.5)); //tototo
xml_init(anObj.Scale(),aTree->Get("Scale",1),double(1.0)); //tototo
xml_init(anObj.Teta(),aTree->Get("Teta",1),double(0.0)); //tototo
xml_init(anObj.BoiteEnglob(),aTree->Get("BoiteEnglob",1)); //tototo
xml_init(anObj.ElInt_CaPImAddedSet(),aTree->Get("ElInt_CaPImAddedSet",1)); //tototo
xml_init(anObj.ElInt_CaPImMyKey(),aTree->Get("ElInt_CaPImMyKey",1)); //tototo
xml_init(anObj.MatrixSplitBox(),aTree->Get("MatrixSplitBox",1)); //tototo
}
std::string Mangling( cContenuAPrioriImage *) {return "B6AD30ECC72316E1FB3F";};
std::list< std::string > & cAPrioriImage::Names()
{
return mNames;
}
const std::list< std::string > & cAPrioriImage::Names()const
{
return mNames;
}
cTplValGesInit< std::string > & cAPrioriImage::KeyedAddedSet()
{
return mKeyedAddedSet;
}
const cTplValGesInit< std::string > & cAPrioriImage::KeyedAddedSet()const
{
return mKeyedAddedSet;
}
cTplValGesInit< std::string > & cAPrioriImage::Key()
{
return mKey;
}
const cTplValGesInit< std::string > & cAPrioriImage::Key()const
{
return mKey;
}
cTplValGesInit< std::string > & cAPrioriImage::KeyAutoAdaptScale()
{
return ContenuAPrioriImage().KeyAutoAdaptScale();
}
const cTplValGesInit< std::string > & cAPrioriImage::KeyAutoAdaptScale()const
{
return ContenuAPrioriImage().KeyAutoAdaptScale();
}
cTplValGesInit< double > & cAPrioriImage::PdsMaxAdaptScale()
{
return ContenuAPrioriImage().PdsMaxAdaptScale();
}
const cTplValGesInit< double > & cAPrioriImage::PdsMaxAdaptScale()const
{
return ContenuAPrioriImage().PdsMaxAdaptScale();
}
cTplValGesInit< double > & cAPrioriImage::Scale()
{
return ContenuAPrioriImage().Scale();
}
const cTplValGesInit< double > & cAPrioriImage::Scale()const
{
return ContenuAPrioriImage().Scale();
}
cTplValGesInit< double > & cAPrioriImage::Teta()
{
return ContenuAPrioriImage().Teta();
}
const cTplValGesInit< double > & cAPrioriImage::Teta()const
{
return ContenuAPrioriImage().Teta();
}
cTplValGesInit< Box2di > & cAPrioriImage::BoiteEnglob()
{
return ContenuAPrioriImage().BoiteEnglob();
}
const cTplValGesInit< Box2di > & cAPrioriImage::BoiteEnglob()const
{
return ContenuAPrioriImage().BoiteEnglob();
}
cTplValGesInit< std::string > & cAPrioriImage::ElInt_CaPImAddedSet()
{
return ContenuAPrioriImage().ElInt_CaPImAddedSet();
}
const cTplValGesInit< std::string > & cAPrioriImage::ElInt_CaPImAddedSet()const
{
return ContenuAPrioriImage().ElInt_CaPImAddedSet();
}
cTplValGesInit< std::string > & cAPrioriImage::ElInt_CaPImMyKey()
{
return ContenuAPrioriImage().ElInt_CaPImMyKey();
}
const cTplValGesInit< std::string > & cAPrioriImage::ElInt_CaPImMyKey()const
{
return ContenuAPrioriImage().ElInt_CaPImMyKey();
}
std::string & cAPrioriImage::KeyMatr()
{
return ContenuAPrioriImage().MatrixSplitBox().Val().KeyMatr();
}
const std::string & cAPrioriImage::KeyMatr()const
{
return ContenuAPrioriImage().MatrixSplitBox().Val().KeyMatr();
}
cTplValGesInit< double > & cAPrioriImage::Rab()
{
return ContenuAPrioriImage().MatrixSplitBox().Val().Rab();
}
const cTplValGesInit< double > & cAPrioriImage::Rab()const
{
return ContenuAPrioriImage().MatrixSplitBox().Val().Rab();
}
cTplValGesInit< cMatrixSplitBox > & cAPrioriImage::MatrixSplitBox()
{
return ContenuAPrioriImage().MatrixSplitBox();
}
const cTplValGesInit< cMatrixSplitBox > & cAPrioriImage::MatrixSplitBox()const
{
return ContenuAPrioriImage().MatrixSplitBox();
}
cContenuAPrioriImage & cAPrioriImage::ContenuAPrioriImage()
{
return mContenuAPrioriImage;
}
const cContenuAPrioriImage & cAPrioriImage::ContenuAPrioriImage()const
{
return mContenuAPrioriImage;
}
void BinaryUnDumpFromFile(cAPrioriImage & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Names().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.KeyedAddedSet().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.KeyedAddedSet().ValForcedForUnUmp(),aFp);
}
else anObj.KeyedAddedSet().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Key().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Key().ValForcedForUnUmp(),aFp);
}
else anObj.Key().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.ContenuAPrioriImage(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cAPrioriImage & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.Names().size());
for( std::list< std::string >::const_iterator iT=anObj.Names().begin();
iT!=anObj.Names().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.KeyedAddedSet().IsInit());
if (anObj.KeyedAddedSet().IsInit()) BinaryDumpInFile(aFp,anObj.KeyedAddedSet().Val());
BinaryDumpInFile(aFp,anObj.Key().IsInit());
if (anObj.Key().IsInit()) BinaryDumpInFile(aFp,anObj.Key().Val());
BinaryDumpInFile(aFp,anObj.ContenuAPrioriImage());
}
cElXMLTree * ToXMLTree(const cAPrioriImage & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"APrioriImage",eXMLBranche);
for
( std::list< std::string >::const_iterator it=anObj.Names().begin();
it !=anObj.Names().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Names"),(*it))->ReTagThis("Names"));
if (anObj.KeyedAddedSet().IsInit())
aRes->AddFils(::ToXMLTree(std::string("KeyedAddedSet"),anObj.KeyedAddedSet().Val())->ReTagThis("KeyedAddedSet"));
if (anObj.Key().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Key"),anObj.Key().Val())->ReTagThis("Key"));
aRes->AddFils(ToXMLTree(anObj.ContenuAPrioriImage())->ReTagThis("ContenuAPrioriImage"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cAPrioriImage & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Names(),aTree->GetAll("Names",false,1));
xml_init(anObj.KeyedAddedSet(),aTree->Get("KeyedAddedSet",1)); //tototo
xml_init(anObj.Key(),aTree->Get("Key",1),std::string("DefKey")); //tototo
xml_init(anObj.ContenuAPrioriImage(),aTree->Get("ContenuAPrioriImage",1)); //tototo
}
std::string Mangling( cAPrioriImage *) {return "F69DF8BDB60EBBC8FE3F";};
cTplValGesInit< bool > & cKeyedNamesAssociations::IsParametrized()
{
return mIsParametrized;
}
const cTplValGesInit< bool > & cKeyedNamesAssociations::IsParametrized()const
{
return mIsParametrized;
}
std::list< cAssocNameToName > & cKeyedNamesAssociations::Calcs()
{
return mCalcs;
}
const std::list< cAssocNameToName > & cKeyedNamesAssociations::Calcs()const
{
return mCalcs;
}
std::string & cKeyedNamesAssociations::Key()
{
return mKey;
}
const std::string & cKeyedNamesAssociations::Key()const
{
return mKey;
}
cTplValGesInit< std::string > & cKeyedNamesAssociations::SubDirAutoMake()
{
return mSubDirAutoMake;
}
const cTplValGesInit< std::string > & cKeyedNamesAssociations::SubDirAutoMake()const
{
return mSubDirAutoMake;
}
cTplValGesInit< bool > & cKeyedNamesAssociations::SubDirAutoMakeRec()
{
return mSubDirAutoMakeRec;
}
const cTplValGesInit< bool > & cKeyedNamesAssociations::SubDirAutoMakeRec()const
{
return mSubDirAutoMakeRec;
}
void BinaryUnDumpFromFile(cKeyedNamesAssociations & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.IsParametrized().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.IsParametrized().ValForcedForUnUmp(),aFp);
}
else anObj.IsParametrized().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cAssocNameToName aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Calcs().push_back(aVal);
}
} ;
BinaryUnDumpFromFile(anObj.Key(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.SubDirAutoMake().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.SubDirAutoMake().ValForcedForUnUmp(),aFp);
}
else anObj.SubDirAutoMake().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.SubDirAutoMakeRec().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.SubDirAutoMakeRec().ValForcedForUnUmp(),aFp);
}
else anObj.SubDirAutoMakeRec().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cKeyedNamesAssociations & anObj)
{
BinaryDumpInFile(aFp,anObj.IsParametrized().IsInit());
if (anObj.IsParametrized().IsInit()) BinaryDumpInFile(aFp,anObj.IsParametrized().Val());
BinaryDumpInFile(aFp,(int)anObj.Calcs().size());
for( std::list< cAssocNameToName >::const_iterator iT=anObj.Calcs().begin();
iT!=anObj.Calcs().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.Key());
BinaryDumpInFile(aFp,anObj.SubDirAutoMake().IsInit());
if (anObj.SubDirAutoMake().IsInit()) BinaryDumpInFile(aFp,anObj.SubDirAutoMake().Val());
BinaryDumpInFile(aFp,anObj.SubDirAutoMakeRec().IsInit());
if (anObj.SubDirAutoMakeRec().IsInit()) BinaryDumpInFile(aFp,anObj.SubDirAutoMakeRec().Val());
}
cElXMLTree * ToXMLTree(const cKeyedNamesAssociations & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"KeyedNamesAssociations",eXMLBranche);
if (anObj.IsParametrized().IsInit())
aRes->AddFils(::ToXMLTree(std::string("IsParametrized"),anObj.IsParametrized().Val())->ReTagThis("IsParametrized"));
for
( std::list< cAssocNameToName >::const_iterator it=anObj.Calcs().begin();
it !=anObj.Calcs().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("Calcs"));
aRes->AddFils(::ToXMLTree(std::string("Key"),anObj.Key())->ReTagThis("Key"));
if (anObj.SubDirAutoMake().IsInit())
aRes->AddFils(::ToXMLTree(std::string("SubDirAutoMake"),anObj.SubDirAutoMake().Val())->ReTagThis("SubDirAutoMake"));
if (anObj.SubDirAutoMakeRec().IsInit())
aRes->AddFils(::ToXMLTree(std::string("SubDirAutoMakeRec"),anObj.SubDirAutoMakeRec().Val())->ReTagThis("SubDirAutoMakeRec"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cKeyedNamesAssociations & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.IsParametrized(),aTree->Get("IsParametrized",1),bool(false)); //tototo
xml_init(anObj.Calcs(),aTree->GetAll("Calcs",false,1));
xml_init(anObj.Key(),aTree->Get("Key",1)); //tototo
xml_init(anObj.SubDirAutoMake(),aTree->Get("SubDirAutoMake",1),std::string("")); //tototo
xml_init(anObj.SubDirAutoMakeRec(),aTree->Get("SubDirAutoMakeRec",1),bool(false)); //tototo
}
std::string Mangling( cKeyedNamesAssociations *) {return "91F4C3B56F2A1AD8FD3F";};
cTplValGesInit< bool > & cKeyedSetsOfNames::IsParametrized()
{
return mIsParametrized;
}
const cTplValGesInit< bool > & cKeyedSetsOfNames::IsParametrized()const
{
return mIsParametrized;
}
cSetNameDescriptor & cKeyedSetsOfNames::Sets()
{
return mSets;
}
const cSetNameDescriptor & cKeyedSetsOfNames::Sets()const
{
return mSets;
}
std::string & cKeyedSetsOfNames::Key()
{
return mKey;
}
const std::string & cKeyedSetsOfNames::Key()const
{
return mKey;
}
void BinaryUnDumpFromFile(cKeyedSetsOfNames & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.IsParametrized().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.IsParametrized().ValForcedForUnUmp(),aFp);
}
else anObj.IsParametrized().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.Sets(),aFp);
BinaryUnDumpFromFile(anObj.Key(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cKeyedSetsOfNames & anObj)
{
BinaryDumpInFile(aFp,anObj.IsParametrized().IsInit());
if (anObj.IsParametrized().IsInit()) BinaryDumpInFile(aFp,anObj.IsParametrized().Val());
BinaryDumpInFile(aFp,anObj.Sets());
BinaryDumpInFile(aFp,anObj.Key());
}
cElXMLTree * ToXMLTree(const cKeyedSetsOfNames & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"KeyedSetsOfNames",eXMLBranche);
if (anObj.IsParametrized().IsInit())
aRes->AddFils(::ToXMLTree(std::string("IsParametrized"),anObj.IsParametrized().Val())->ReTagThis("IsParametrized"));
aRes->AddFils(ToXMLTree(anObj.Sets())->ReTagThis("Sets"));
aRes->AddFils(::ToXMLTree(std::string("Key"),anObj.Key())->ReTagThis("Key"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cKeyedSetsOfNames & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.IsParametrized(),aTree->Get("IsParametrized",1),bool(false)); //tototo
xml_init(anObj.Sets(),aTree->Get("Sets",1)); //tototo
xml_init(anObj.Key(),aTree->Get("Key",1)); //tototo
}
std::string Mangling( cKeyedSetsOfNames *) {return "7AB48553C57D5586FD3F";};
cTplValGesInit< bool > & cKeyedSetsORels::IsParametrized()
{
return mIsParametrized;
}
const cTplValGesInit< bool > & cKeyedSetsORels::IsParametrized()const
{
return mIsParametrized;
}
cNameRelDescriptor & cKeyedSetsORels::Sets()
{
return mSets;
}
const cNameRelDescriptor & cKeyedSetsORels::Sets()const
{
return mSets;
}
std::string & cKeyedSetsORels::Key()
{
return mKey;
}
const std::string & cKeyedSetsORels::Key()const
{
return mKey;
}
void BinaryUnDumpFromFile(cKeyedSetsORels & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.IsParametrized().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.IsParametrized().ValForcedForUnUmp(),aFp);
}
else anObj.IsParametrized().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.Sets(),aFp);
BinaryUnDumpFromFile(anObj.Key(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cKeyedSetsORels & anObj)
{
BinaryDumpInFile(aFp,anObj.IsParametrized().IsInit());
if (anObj.IsParametrized().IsInit()) BinaryDumpInFile(aFp,anObj.IsParametrized().Val());
BinaryDumpInFile(aFp,anObj.Sets());
BinaryDumpInFile(aFp,anObj.Key());
}
cElXMLTree * ToXMLTree(const cKeyedSetsORels & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"KeyedSetsORels",eXMLBranche);
if (anObj.IsParametrized().IsInit())
aRes->AddFils(::ToXMLTree(std::string("IsParametrized"),anObj.IsParametrized().Val())->ReTagThis("IsParametrized"));
aRes->AddFils(ToXMLTree(anObj.Sets())->ReTagThis("Sets"));
aRes->AddFils(::ToXMLTree(std::string("Key"),anObj.Key())->ReTagThis("Key"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cKeyedSetsORels & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.IsParametrized(),aTree->Get("IsParametrized",1),bool(false)); //tototo
xml_init(anObj.Sets(),aTree->Get("Sets",1)); //tototo
xml_init(anObj.Key(),aTree->Get("Key",1)); //tototo
}
std::string Mangling( cKeyedSetsORels *) {return "94EAA75A1B4DAAD7FD3F";};
cImMatrixStructuration & cKeyedMatrixStruct::Matrix()
{
return mMatrix;
}
const cImMatrixStructuration & cKeyedMatrixStruct::Matrix()const
{
return mMatrix;
}
std::string & cKeyedMatrixStruct::Key()
{
return mKey;
}
const std::string & cKeyedMatrixStruct::Key()const
{
return mKey;
}
void BinaryUnDumpFromFile(cKeyedMatrixStruct & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Matrix(),aFp);
BinaryUnDumpFromFile(anObj.Key(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cKeyedMatrixStruct & anObj)
{
BinaryDumpInFile(aFp,anObj.Matrix());
BinaryDumpInFile(aFp,anObj.Key());
}
cElXMLTree * ToXMLTree(const cKeyedMatrixStruct & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"KeyedMatrixStruct",eXMLBranche);
aRes->AddFils(ToXMLTree(anObj.Matrix())->ReTagThis("Matrix"));
aRes->AddFils(::ToXMLTree(std::string("Key"),anObj.Key())->ReTagThis("Key"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cKeyedMatrixStruct & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Matrix(),aTree->Get("Matrix",1)); //tototo
xml_init(anObj.Key(),aTree->Get("Key",1)); //tototo
}
std::string Mangling( cKeyedMatrixStruct *) {return "46D3A9761F048AE9FC3F";};
cTplValGesInit< bool > & cChantierDescripteur::ExitOnBrkp()
{
return mExitOnBrkp;
}
const cTplValGesInit< bool > & cChantierDescripteur::ExitOnBrkp()const
{
return mExitOnBrkp;
}
std::list< std::string > & cChantierDescripteur::Symb()
{
return mSymb;
}
const std::list< std::string > & cChantierDescripteur::Symb()const
{
return mSymb;
}
std::list< std::string > & cChantierDescripteur::eSymb()
{
return meSymb;
}
const std::list< std::string > & cChantierDescripteur::eSymb()const
{
return meSymb;
}
cTplValGesInit< cMMCameraDataBase > & cChantierDescripteur::LocCamDataBase()
{
return mLocCamDataBase;
}
const cTplValGesInit< cMMCameraDataBase > & cChantierDescripteur::LocCamDataBase()const
{
return mLocCamDataBase;
}
std::string & cChantierDescripteur::KeySetCollectXif()
{
return MakeDataBase().Val().KeySetCollectXif();
}
const std::string & cChantierDescripteur::KeySetCollectXif()const
{
return MakeDataBase().Val().KeySetCollectXif();
}
std::list< std::string > & cChantierDescripteur::KeyAssocNameSup()
{
return MakeDataBase().Val().KeyAssocNameSup();
}
const std::list< std::string > & cChantierDescripteur::KeyAssocNameSup()const
{
return MakeDataBase().Val().KeyAssocNameSup();
}
cTplValGesInit< std::string > & cChantierDescripteur::NameFile()
{
return MakeDataBase().Val().NameFile();
}
const cTplValGesInit< std::string > & cChantierDescripteur::NameFile()const
{
return MakeDataBase().Val().NameFile();
}
cTplValGesInit< cMakeDataBase > & cChantierDescripteur::MakeDataBase()
{
return mMakeDataBase;
}
const cTplValGesInit< cMakeDataBase > & cChantierDescripteur::MakeDataBase()const
{
return mMakeDataBase;
}
cTplValGesInit< std::string > & cChantierDescripteur::KeySuprAbs2Rel()
{
return mKeySuprAbs2Rel;
}
const cTplValGesInit< std::string > & cChantierDescripteur::KeySuprAbs2Rel()const
{
return mKeySuprAbs2Rel;
}
std::list< cBatchChantDesc > & cChantierDescripteur::BatchChantDesc()
{
return mBatchChantDesc;
}
const std::list< cBatchChantDesc > & cChantierDescripteur::BatchChantDesc()const
{
return mBatchChantDesc;
}
std::list< cShowChantDesc > & cChantierDescripteur::ShowChantDesc()
{
return mShowChantDesc;
}
const std::list< cShowChantDesc > & cChantierDescripteur::ShowChantDesc()const
{
return mShowChantDesc;
}
std::list< cAPrioriImage > & cChantierDescripteur::APrioriImage()
{
return mAPrioriImage;
}
const std::list< cAPrioriImage > & cChantierDescripteur::APrioriImage()const
{
return mAPrioriImage;
}
std::list< cKeyedNamesAssociations > & cChantierDescripteur::KeyedNamesAssociations()
{
return mKeyedNamesAssociations;
}
const std::list< cKeyedNamesAssociations > & cChantierDescripteur::KeyedNamesAssociations()const
{
return mKeyedNamesAssociations;
}
std::list< cKeyedSetsOfNames > & cChantierDescripteur::KeyedSetsOfNames()
{
return mKeyedSetsOfNames;
}
const std::list< cKeyedSetsOfNames > & cChantierDescripteur::KeyedSetsOfNames()const
{
return mKeyedSetsOfNames;
}
std::list< cKeyedSetsORels > & cChantierDescripteur::KeyedSetsORels()
{
return mKeyedSetsORels;
}
const std::list< cKeyedSetsORels > & cChantierDescripteur::KeyedSetsORels()const
{
return mKeyedSetsORels;
}
std::list< cKeyedMatrixStruct > & cChantierDescripteur::KeyedMatrixStruct()
{
return mKeyedMatrixStruct;
}
const std::list< cKeyedMatrixStruct > & cChantierDescripteur::KeyedMatrixStruct()const
{
return mKeyedMatrixStruct;
}
std::list< cClassEquivDescripteur > & cChantierDescripteur::KeyedClassEquiv()
{
return mKeyedClassEquiv;
}
const std::list< cClassEquivDescripteur > & cChantierDescripteur::KeyedClassEquiv()const
{
return mKeyedClassEquiv;
}
cTplValGesInit< cBaseDataCD > & cChantierDescripteur::BaseDatas()
{
return mBaseDatas;
}
const cTplValGesInit< cBaseDataCD > & cChantierDescripteur::BaseDatas()const
{
return mBaseDatas;
}
std::list< std::string > & cChantierDescripteur::FilesDatas()
{
return mFilesDatas;
}
const std::list< std::string > & cChantierDescripteur::FilesDatas()const
{
return mFilesDatas;
}
void BinaryUnDumpFromFile(cChantierDescripteur & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ExitOnBrkp().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ExitOnBrkp().ValForcedForUnUmp(),aFp);
}
else anObj.ExitOnBrkp().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Symb().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.eSymb().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.LocCamDataBase().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.LocCamDataBase().ValForcedForUnUmp(),aFp);
}
else anObj.LocCamDataBase().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.MakeDataBase().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.MakeDataBase().ValForcedForUnUmp(),aFp);
}
else anObj.MakeDataBase().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.KeySuprAbs2Rel().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.KeySuprAbs2Rel().ValForcedForUnUmp(),aFp);
}
else anObj.KeySuprAbs2Rel().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cBatchChantDesc aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.BatchChantDesc().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cShowChantDesc aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ShowChantDesc().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cAPrioriImage aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.APrioriImage().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cKeyedNamesAssociations aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.KeyedNamesAssociations().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cKeyedSetsOfNames aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.KeyedSetsOfNames().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cKeyedSetsORels aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.KeyedSetsORels().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cKeyedMatrixStruct aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.KeyedMatrixStruct().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cClassEquivDescripteur aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.KeyedClassEquiv().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.BaseDatas().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.BaseDatas().ValForcedForUnUmp(),aFp);
}
else anObj.BaseDatas().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.FilesDatas().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cChantierDescripteur & anObj)
{
BinaryDumpInFile(aFp,anObj.ExitOnBrkp().IsInit());
if (anObj.ExitOnBrkp().IsInit()) BinaryDumpInFile(aFp,anObj.ExitOnBrkp().Val());
BinaryDumpInFile(aFp,(int)anObj.Symb().size());
for( std::list< std::string >::const_iterator iT=anObj.Symb().begin();
iT!=anObj.Symb().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.eSymb().size());
for( std::list< std::string >::const_iterator iT=anObj.eSymb().begin();
iT!=anObj.eSymb().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.LocCamDataBase().IsInit());
if (anObj.LocCamDataBase().IsInit()) BinaryDumpInFile(aFp,anObj.LocCamDataBase().Val());
BinaryDumpInFile(aFp,anObj.MakeDataBase().IsInit());
if (anObj.MakeDataBase().IsInit()) BinaryDumpInFile(aFp,anObj.MakeDataBase().Val());
BinaryDumpInFile(aFp,anObj.KeySuprAbs2Rel().IsInit());
if (anObj.KeySuprAbs2Rel().IsInit()) BinaryDumpInFile(aFp,anObj.KeySuprAbs2Rel().Val());
BinaryDumpInFile(aFp,(int)anObj.BatchChantDesc().size());
for( std::list< cBatchChantDesc >::const_iterator iT=anObj.BatchChantDesc().begin();
iT!=anObj.BatchChantDesc().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.ShowChantDesc().size());
for( std::list< cShowChantDesc >::const_iterator iT=anObj.ShowChantDesc().begin();
iT!=anObj.ShowChantDesc().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.APrioriImage().size());
for( std::list< cAPrioriImage >::const_iterator iT=anObj.APrioriImage().begin();
iT!=anObj.APrioriImage().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.KeyedNamesAssociations().size());
for( std::list< cKeyedNamesAssociations >::const_iterator iT=anObj.KeyedNamesAssociations().begin();
iT!=anObj.KeyedNamesAssociations().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.KeyedSetsOfNames().size());
for( std::list< cKeyedSetsOfNames >::const_iterator iT=anObj.KeyedSetsOfNames().begin();
iT!=anObj.KeyedSetsOfNames().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.KeyedSetsORels().size());
for( std::list< cKeyedSetsORels >::const_iterator iT=anObj.KeyedSetsORels().begin();
iT!=anObj.KeyedSetsORels().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.KeyedMatrixStruct().size());
for( std::list< cKeyedMatrixStruct >::const_iterator iT=anObj.KeyedMatrixStruct().begin();
iT!=anObj.KeyedMatrixStruct().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.KeyedClassEquiv().size());
for( std::list< cClassEquivDescripteur >::const_iterator iT=anObj.KeyedClassEquiv().begin();
iT!=anObj.KeyedClassEquiv().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.BaseDatas().IsInit());
if (anObj.BaseDatas().IsInit()) BinaryDumpInFile(aFp,anObj.BaseDatas().Val());
BinaryDumpInFile(aFp,(int)anObj.FilesDatas().size());
for( std::list< std::string >::const_iterator iT=anObj.FilesDatas().begin();
iT!=anObj.FilesDatas().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cChantierDescripteur & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ChantierDescripteur",eXMLBranche);
if (anObj.ExitOnBrkp().IsInit())
aRes->AddFils(::ToXMLTree(std::string("ExitOnBrkp"),anObj.ExitOnBrkp().Val())->ReTagThis("ExitOnBrkp"));
for
( std::list< std::string >::const_iterator it=anObj.Symb().begin();
it !=anObj.Symb().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Symb"),(*it))->ReTagThis("Symb"));
for
( std::list< std::string >::const_iterator it=anObj.eSymb().begin();
it !=anObj.eSymb().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("eSymb"),(*it))->ReTagThis("eSymb"));
if (anObj.LocCamDataBase().IsInit())
aRes->AddFils(ToXMLTree(anObj.LocCamDataBase().Val())->ReTagThis("LocCamDataBase"));
if (anObj.MakeDataBase().IsInit())
aRes->AddFils(ToXMLTree(anObj.MakeDataBase().Val())->ReTagThis("MakeDataBase"));
if (anObj.KeySuprAbs2Rel().IsInit())
aRes->AddFils(::ToXMLTree(std::string("KeySuprAbs2Rel"),anObj.KeySuprAbs2Rel().Val())->ReTagThis("KeySuprAbs2Rel"));
for
( std::list< cBatchChantDesc >::const_iterator it=anObj.BatchChantDesc().begin();
it !=anObj.BatchChantDesc().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("BatchChantDesc"));
for
( std::list< cShowChantDesc >::const_iterator it=anObj.ShowChantDesc().begin();
it !=anObj.ShowChantDesc().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("ShowChantDesc"));
for
( std::list< cAPrioriImage >::const_iterator it=anObj.APrioriImage().begin();
it !=anObj.APrioriImage().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("APrioriImage"));
for
( std::list< cKeyedNamesAssociations >::const_iterator it=anObj.KeyedNamesAssociations().begin();
it !=anObj.KeyedNamesAssociations().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("KeyedNamesAssociations"));
for
( std::list< cKeyedSetsOfNames >::const_iterator it=anObj.KeyedSetsOfNames().begin();
it !=anObj.KeyedSetsOfNames().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("KeyedSetsOfNames"));
for
( std::list< cKeyedSetsORels >::const_iterator it=anObj.KeyedSetsORels().begin();
it !=anObj.KeyedSetsORels().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("KeyedSetsORels"));
for
( std::list< cKeyedMatrixStruct >::const_iterator it=anObj.KeyedMatrixStruct().begin();
it !=anObj.KeyedMatrixStruct().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("KeyedMatrixStruct"));
for
( std::list< cClassEquivDescripteur >::const_iterator it=anObj.KeyedClassEquiv().begin();
it !=anObj.KeyedClassEquiv().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("KeyedClassEquiv"));
if (anObj.BaseDatas().IsInit())
aRes->AddFils(ToXMLTree(anObj.BaseDatas().Val())->ReTagThis("BaseDatas"));
for
( std::list< std::string >::const_iterator it=anObj.FilesDatas().begin();
it !=anObj.FilesDatas().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("FilesDatas"),(*it))->ReTagThis("FilesDatas"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cChantierDescripteur & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.ExitOnBrkp(),aTree->Get("ExitOnBrkp",1)); //tototo
xml_init(anObj.Symb(),aTree->GetAll("Symb",false,1));
xml_init(anObj.eSymb(),aTree->GetAll("eSymb",false,1));
xml_init(anObj.LocCamDataBase(),aTree->Get("LocCamDataBase",1)); //tototo
xml_init(anObj.MakeDataBase(),aTree->Get("MakeDataBase",1)); //tototo
xml_init(anObj.KeySuprAbs2Rel(),aTree->Get("KeySuprAbs2Rel",1)); //tototo
xml_init(anObj.BatchChantDesc(),aTree->GetAll("BatchChantDesc",false,1));
xml_init(anObj.ShowChantDesc(),aTree->GetAll("ShowChantDesc",false,1));
xml_init(anObj.APrioriImage(),aTree->GetAll("APrioriImage",false,1));
xml_init(anObj.KeyedNamesAssociations(),aTree->GetAll("KeyedNamesAssociations",false,1));
xml_init(anObj.KeyedSetsOfNames(),aTree->GetAll("KeyedSetsOfNames",false,1));
xml_init(anObj.KeyedSetsORels(),aTree->GetAll("KeyedSetsORels",false,1));
xml_init(anObj.KeyedMatrixStruct(),aTree->GetAll("KeyedMatrixStruct",false,1));
xml_init(anObj.KeyedClassEquiv(),aTree->GetAll("KeyedClassEquiv",false,1));
xml_init(anObj.BaseDatas(),aTree->Get("BaseDatas",1)); //tototo
xml_init(anObj.FilesDatas(),aTree->GetAll("FilesDatas",false,1));
}
std::string Mangling( cChantierDescripteur *) {return "9A106A02E369FDE6FC3F";};
int & cXML_Date::year()
{
return myear;
}
const int & cXML_Date::year()const
{
return myear;
}
int & cXML_Date::month()
{
return mmonth;
}
const int & cXML_Date::month()const
{
return mmonth;
}
int & cXML_Date::day()
{
return mday;
}
const int & cXML_Date::day()const
{
return mday;
}
int & cXML_Date::hour()
{
return mhour;
}
const int & cXML_Date::hour()const
{
return mhour;
}
int & cXML_Date::minute()
{
return mminute;
}
const int & cXML_Date::minute()const
{
return mminute;
}
int & cXML_Date::second()
{
return msecond;
}
const int & cXML_Date::second()const
{
return msecond;
}
std::string & cXML_Date::time_system()
{
return mtime_system;
}
const std::string & cXML_Date::time_system()const
{
return mtime_system;
}
void BinaryUnDumpFromFile(cXML_Date & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.year(),aFp);
BinaryUnDumpFromFile(anObj.month(),aFp);
BinaryUnDumpFromFile(anObj.day(),aFp);
BinaryUnDumpFromFile(anObj.hour(),aFp);
BinaryUnDumpFromFile(anObj.minute(),aFp);
BinaryUnDumpFromFile(anObj.second(),aFp);
BinaryUnDumpFromFile(anObj.time_system(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXML_Date & anObj)
{
BinaryDumpInFile(aFp,anObj.year());
BinaryDumpInFile(aFp,anObj.month());
BinaryDumpInFile(aFp,anObj.day());
BinaryDumpInFile(aFp,anObj.hour());
BinaryDumpInFile(aFp,anObj.minute());
BinaryDumpInFile(aFp,anObj.second());
BinaryDumpInFile(aFp,anObj.time_system());
}
cElXMLTree * ToXMLTree(const cXML_Date & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XML_Date",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("year"),anObj.year())->ReTagThis("year"));
aRes->AddFils(::ToXMLTree(std::string("month"),anObj.month())->ReTagThis("month"));
aRes->AddFils(::ToXMLTree(std::string("day"),anObj.day())->ReTagThis("day"));
aRes->AddFils(::ToXMLTree(std::string("hour"),anObj.hour())->ReTagThis("hour"));
aRes->AddFils(::ToXMLTree(std::string("minute"),anObj.minute())->ReTagThis("minute"));
aRes->AddFils(::ToXMLTree(std::string("second"),anObj.second())->ReTagThis("second"));
aRes->AddFils(::ToXMLTree(std::string("time_system"),anObj.time_system())->ReTagThis("time_system"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXML_Date & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.year(),aTree->Get("year",1)); //tototo
xml_init(anObj.month(),aTree->Get("month",1)); //tototo
xml_init(anObj.day(),aTree->Get("day",1)); //tototo
xml_init(anObj.hour(),aTree->Get("hour",1)); //tototo
xml_init(anObj.minute(),aTree->Get("minute",1)); //tototo
xml_init(anObj.second(),aTree->Get("second",1)); //tototo
xml_init(anObj.time_system(),aTree->Get("time_system",1)); //tototo
}
std::string Mangling( cXML_Date *) {return "6E9DE981E9779EBFFD3F";};
double & cpt3d::x()
{
return mx;
}
const double & cpt3d::x()const
{
return mx;
}
double & cpt3d::y()
{
return my;
}
const double & cpt3d::y()const
{
return my;
}
double & cpt3d::z()
{
return mz;
}
const double & cpt3d::z()const
{
return mz;
}
void BinaryUnDumpFromFile(cpt3d & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.x(),aFp);
BinaryUnDumpFromFile(anObj.y(),aFp);
BinaryUnDumpFromFile(anObj.z(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cpt3d & anObj)
{
BinaryDumpInFile(aFp,anObj.x());
BinaryDumpInFile(aFp,anObj.y());
BinaryDumpInFile(aFp,anObj.z());
}
cElXMLTree * ToXMLTree(const cpt3d & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"pt3d",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("x"),anObj.x())->ReTagThis("x"));
aRes->AddFils(::ToXMLTree(std::string("y"),anObj.y())->ReTagThis("y"));
aRes->AddFils(::ToXMLTree(std::string("z"),anObj.z())->ReTagThis("z"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cpt3d & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.x(),aTree->Get("x",1)); //tototo
xml_init(anObj.y(),aTree->Get("y",1)); //tototo
xml_init(anObj.z(),aTree->Get("z",1)); //tototo
}
std::string Mangling( cpt3d *) {return "80553F1BDE3FE09CF73F";};
double & cXML_LinePt3d::x()
{
return pt3d().x();
}
const double & cXML_LinePt3d::x()const
{
return pt3d().x();
}
double & cXML_LinePt3d::y()
{
return pt3d().y();
}
const double & cXML_LinePt3d::y()const
{
return pt3d().y();
}
double & cXML_LinePt3d::z()
{
return pt3d().z();
}
const double & cXML_LinePt3d::z()const
{
return pt3d().z();
}
cpt3d & cXML_LinePt3d::pt3d()
{
return mpt3d;
}
const cpt3d & cXML_LinePt3d::pt3d()const
{
return mpt3d;
}
void BinaryUnDumpFromFile(cXML_LinePt3d & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.pt3d(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXML_LinePt3d & anObj)
{
BinaryDumpInFile(aFp,anObj.pt3d());
}
cElXMLTree * ToXMLTree(const cXML_LinePt3d & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XML_LinePt3d",eXMLBranche);
aRes->AddFils(ToXMLTree(anObj.pt3d())->ReTagThis("pt3d"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXML_LinePt3d & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.pt3d(),aTree->Get("pt3d",1)); //tototo
}
std::string Mangling( cXML_LinePt3d *) {return "7CA95D10E84A4AFCFDBF";};
std::list< std::string > & cOneSolImageSec::Images()
{
return mImages;
}
const std::list< std::string > & cOneSolImageSec::Images()const
{
return mImages;
}
double & cOneSolImageSec::Coverage()
{
return mCoverage;
}
const double & cOneSolImageSec::Coverage()const
{
return mCoverage;
}
double & cOneSolImageSec::Score()
{
return mScore;
}
const double & cOneSolImageSec::Score()const
{
return mScore;
}
void BinaryUnDumpFromFile(cOneSolImageSec & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Images().push_back(aVal);
}
} ;
BinaryUnDumpFromFile(anObj.Coverage(),aFp);
BinaryUnDumpFromFile(anObj.Score(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cOneSolImageSec & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.Images().size());
for( std::list< std::string >::const_iterator iT=anObj.Images().begin();
iT!=anObj.Images().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.Coverage());
BinaryDumpInFile(aFp,anObj.Score());
}
cElXMLTree * ToXMLTree(const cOneSolImageSec & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"OneSolImageSec",eXMLBranche);
for
( std::list< std::string >::const_iterator it=anObj.Images().begin();
it !=anObj.Images().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Images"),(*it))->ReTagThis("Images"));
aRes->AddFils(::ToXMLTree(std::string("Coverage"),anObj.Coverage())->ReTagThis("Coverage"));
aRes->AddFils(::ToXMLTree(std::string("Score"),anObj.Score())->ReTagThis("Score"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cOneSolImageSec & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Images(),aTree->GetAll("Images",false,1));
xml_init(anObj.Coverage(),aTree->Get("Coverage",1)); //tototo
xml_init(anObj.Score(),aTree->Get("Score",1)); //tototo
}
std::string Mangling( cOneSolImageSec *) {return "EAF6D9FE51CF3A93FC3F";};
std::string & cISOM_Vois::Name()
{
return mName;
}
const std::string & cISOM_Vois::Name()const
{
return mName;
}
double & cISOM_Vois::Angle()
{
return mAngle;
}
const double & cISOM_Vois::Angle()const
{
return mAngle;
}
double & cISOM_Vois::Nb()
{
return mNb;
}
const double & cISOM_Vois::Nb()const
{
return mNb;
}
cTplValGesInit< double > & cISOM_Vois::RatioVis()
{
return mRatioVis;
}
const cTplValGesInit< double > & cISOM_Vois::RatioVis()const
{
return mRatioVis;
}
void BinaryUnDumpFromFile(cISOM_Vois & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Name(),aFp);
BinaryUnDumpFromFile(anObj.Angle(),aFp);
BinaryUnDumpFromFile(anObj.Nb(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.RatioVis().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.RatioVis().ValForcedForUnUmp(),aFp);
}
else anObj.RatioVis().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cISOM_Vois & anObj)
{
BinaryDumpInFile(aFp,anObj.Name());
BinaryDumpInFile(aFp,anObj.Angle());
BinaryDumpInFile(aFp,anObj.Nb());
BinaryDumpInFile(aFp,anObj.RatioVis().IsInit());
if (anObj.RatioVis().IsInit()) BinaryDumpInFile(aFp,anObj.RatioVis().Val());
}
cElXMLTree * ToXMLTree(const cISOM_Vois & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ISOM_Vois",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Name"),anObj.Name())->ReTagThis("Name"));
aRes->AddFils(::ToXMLTree(std::string("Angle"),anObj.Angle())->ReTagThis("Angle"));
aRes->AddFils(::ToXMLTree(std::string("Nb"),anObj.Nb())->ReTagThis("Nb"));
if (anObj.RatioVis().IsInit())
aRes->AddFils(::ToXMLTree(std::string("RatioVis"),anObj.RatioVis().Val())->ReTagThis("RatioVis"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cISOM_Vois & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Name(),aTree->Get("Name",1)); //tototo
xml_init(anObj.Angle(),aTree->Get("Angle",1)); //tototo
xml_init(anObj.Nb(),aTree->Get("Nb",1)); //tototo
xml_init(anObj.RatioVis(),aTree->Get("RatioVis",1)); //tototo
}
std::string Mangling( cISOM_Vois *) {return "1C5857083702A7CDFD3F";};
std::list< cISOM_Vois > & cISOM_AllVois::ISOM_Vois()
{
return mISOM_Vois;
}
const std::list< cISOM_Vois > & cISOM_AllVois::ISOM_Vois()const
{
return mISOM_Vois;
}
void BinaryUnDumpFromFile(cISOM_AllVois & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cISOM_Vois aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ISOM_Vois().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cISOM_AllVois & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.ISOM_Vois().size());
for( std::list< cISOM_Vois >::const_iterator iT=anObj.ISOM_Vois().begin();
iT!=anObj.ISOM_Vois().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cISOM_AllVois & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ISOM_AllVois",eXMLBranche);
for
( std::list< cISOM_Vois >::const_iterator it=anObj.ISOM_Vois().begin();
it !=anObj.ISOM_Vois().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("ISOM_Vois"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cISOM_AllVois & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.ISOM_Vois(),aTree->GetAll("ISOM_Vois",false,1));
}
std::string Mangling( cISOM_AllVois *) {return "285F177773D702B8FF3F";};
cTplValGesInit< double > & cImSecOfMaster::UsedPenal()
{
return mUsedPenal;
}
const cTplValGesInit< double > & cImSecOfMaster::UsedPenal()const
{
return mUsedPenal;
}
std::string & cImSecOfMaster::Master()
{
return mMaster;
}
const std::string & cImSecOfMaster::Master()const
{
return mMaster;
}
std::list< cOneSolImageSec > & cImSecOfMaster::Sols()
{
return mSols;
}
const std::list< cOneSolImageSec > & cImSecOfMaster::Sols()const
{
return mSols;
}
cTplValGesInit< cISOM_AllVois > & cImSecOfMaster::ISOM_AllVois()
{
return mISOM_AllVois;
}
const cTplValGesInit< cISOM_AllVois > & cImSecOfMaster::ISOM_AllVois()const
{
return mISOM_AllVois;
}
void BinaryUnDumpFromFile(cImSecOfMaster & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.UsedPenal().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.UsedPenal().ValForcedForUnUmp(),aFp);
}
else anObj.UsedPenal().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.Master(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cOneSolImageSec aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Sols().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ISOM_AllVois().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ISOM_AllVois().ValForcedForUnUmp(),aFp);
}
else anObj.ISOM_AllVois().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cImSecOfMaster & anObj)
{
BinaryDumpInFile(aFp,anObj.UsedPenal().IsInit());
if (anObj.UsedPenal().IsInit()) BinaryDumpInFile(aFp,anObj.UsedPenal().Val());
BinaryDumpInFile(aFp,anObj.Master());
BinaryDumpInFile(aFp,(int)anObj.Sols().size());
for( std::list< cOneSolImageSec >::const_iterator iT=anObj.Sols().begin();
iT!=anObj.Sols().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.ISOM_AllVois().IsInit());
if (anObj.ISOM_AllVois().IsInit()) BinaryDumpInFile(aFp,anObj.ISOM_AllVois().Val());
}
cElXMLTree * ToXMLTree(const cImSecOfMaster & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ImSecOfMaster",eXMLBranche);
if (anObj.UsedPenal().IsInit())
aRes->AddFils(::ToXMLTree(std::string("UsedPenal"),anObj.UsedPenal().Val())->ReTagThis("UsedPenal"));
aRes->AddFils(::ToXMLTree(std::string("Master"),anObj.Master())->ReTagThis("Master"));
for
( std::list< cOneSolImageSec >::const_iterator it=anObj.Sols().begin();
it !=anObj.Sols().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("Sols"));
if (anObj.ISOM_AllVois().IsInit())
aRes->AddFils(ToXMLTree(anObj.ISOM_AllVois().Val())->ReTagThis("ISOM_AllVois"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cImSecOfMaster & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.UsedPenal(),aTree->Get("UsedPenal",1),double(0.333)); //tototo
xml_init(anObj.Master(),aTree->Get("Master",1)); //tototo
xml_init(anObj.Sols(),aTree->GetAll("Sols",false,1));
xml_init(anObj.ISOM_AllVois(),aTree->Get("ISOM_AllVois",1)); //tototo
}
std::string Mangling( cImSecOfMaster *) {return "04DB5168C8BC39ABFF3F";};
std::string & cParamOrientSHC::IdGrp()
{
return mIdGrp;
}
const std::string & cParamOrientSHC::IdGrp()const
{
return mIdGrp;
}
Pt3dr & cParamOrientSHC::Vecteur()
{
return mVecteur;
}
const Pt3dr & cParamOrientSHC::Vecteur()const
{
return mVecteur;
}
cTypeCodageMatr & cParamOrientSHC::Rot()
{
return mRot;
}
const cTypeCodageMatr & cParamOrientSHC::Rot()const
{
return mRot;
}
void BinaryUnDumpFromFile(cParamOrientSHC & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.IdGrp(),aFp);
BinaryUnDumpFromFile(anObj.Vecteur(),aFp);
BinaryUnDumpFromFile(anObj.Rot(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cParamOrientSHC & anObj)
{
BinaryDumpInFile(aFp,anObj.IdGrp());
BinaryDumpInFile(aFp,anObj.Vecteur());
BinaryDumpInFile(aFp,anObj.Rot());
}
cElXMLTree * ToXMLTree(const cParamOrientSHC & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ParamOrientSHC",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("IdGrp"),anObj.IdGrp())->ReTagThis("IdGrp"));
aRes->AddFils(ToXMLTree(std::string("Vecteur"),anObj.Vecteur())->ReTagThis("Vecteur"));
aRes->AddFils(ToXMLTree(anObj.Rot())->ReTagThis("Rot"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cParamOrientSHC & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.IdGrp(),aTree->Get("IdGrp",1)); //tototo
xml_init(anObj.Vecteur(),aTree->Get("Vecteur",1)); //tototo
xml_init(anObj.Rot(),aTree->Get("Rot",1)); //tototo
}
std::string Mangling( cParamOrientSHC *) {return "1839B2585465798AFBBF";};
std::list< cParamOrientSHC > & cLiaisonsSHC::ParamOrientSHC()
{
return mParamOrientSHC;
}
const std::list< cParamOrientSHC > & cLiaisonsSHC::ParamOrientSHC()const
{
return mParamOrientSHC;
}
void BinaryUnDumpFromFile(cLiaisonsSHC & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cParamOrientSHC aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ParamOrientSHC().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cLiaisonsSHC & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.ParamOrientSHC().size());
for( std::list< cParamOrientSHC >::const_iterator iT=anObj.ParamOrientSHC().begin();
iT!=anObj.ParamOrientSHC().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cLiaisonsSHC & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"LiaisonsSHC",eXMLBranche);
for
( std::list< cParamOrientSHC >::const_iterator it=anObj.ParamOrientSHC().begin();
it !=anObj.ParamOrientSHC().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("ParamOrientSHC"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cLiaisonsSHC & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.ParamOrientSHC(),aTree->GetAll("ParamOrientSHC",false,1));
}
std::string Mangling( cLiaisonsSHC *) {return "8614379849CDAEAFFE3F";};
std::string & cStructBlockCam::KeyIm2TimeCam()
{
return mKeyIm2TimeCam;
}
const std::string & cStructBlockCam::KeyIm2TimeCam()const
{
return mKeyIm2TimeCam;
}
cTplValGesInit< std::string > & cStructBlockCam::MasterGrp()
{
return mMasterGrp;
}
const cTplValGesInit< std::string > & cStructBlockCam::MasterGrp()const
{
return mMasterGrp;
}
std::list< cParamOrientSHC > & cStructBlockCam::ParamOrientSHC()
{
return LiaisonsSHC().Val().ParamOrientSHC();
}
const std::list< cParamOrientSHC > & cStructBlockCam::ParamOrientSHC()const
{
return LiaisonsSHC().Val().ParamOrientSHC();
}
cTplValGesInit< cLiaisonsSHC > & cStructBlockCam::LiaisonsSHC()
{
return mLiaisonsSHC;
}
const cTplValGesInit< cLiaisonsSHC > & cStructBlockCam::LiaisonsSHC()const
{
return mLiaisonsSHC;
}
void BinaryUnDumpFromFile(cStructBlockCam & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.KeyIm2TimeCam(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.MasterGrp().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.MasterGrp().ValForcedForUnUmp(),aFp);
}
else anObj.MasterGrp().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.LiaisonsSHC().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.LiaisonsSHC().ValForcedForUnUmp(),aFp);
}
else anObj.LiaisonsSHC().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cStructBlockCam & anObj)
{
BinaryDumpInFile(aFp,anObj.KeyIm2TimeCam());
BinaryDumpInFile(aFp,anObj.MasterGrp().IsInit());
if (anObj.MasterGrp().IsInit()) BinaryDumpInFile(aFp,anObj.MasterGrp().Val());
BinaryDumpInFile(aFp,anObj.LiaisonsSHC().IsInit());
if (anObj.LiaisonsSHC().IsInit()) BinaryDumpInFile(aFp,anObj.LiaisonsSHC().Val());
}
cElXMLTree * ToXMLTree(const cStructBlockCam & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"StructBlockCam",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("KeyIm2TimeCam"),anObj.KeyIm2TimeCam())->ReTagThis("KeyIm2TimeCam"));
if (anObj.MasterGrp().IsInit())
aRes->AddFils(::ToXMLTree(std::string("MasterGrp"),anObj.MasterGrp().Val())->ReTagThis("MasterGrp"));
if (anObj.LiaisonsSHC().IsInit())
aRes->AddFils(ToXMLTree(anObj.LiaisonsSHC().Val())->ReTagThis("LiaisonsSHC"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cStructBlockCam & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeyIm2TimeCam(),aTree->Get("KeyIm2TimeCam",1)); //tototo
xml_init(anObj.MasterGrp(),aTree->Get("MasterGrp",1)); //tototo
xml_init(anObj.LiaisonsSHC(),aTree->Get("LiaisonsSHC",1)); //tototo
}
std::string Mangling( cStructBlockCam *) {return "9231968F03FA00A5FF3F";};
std::list< std::string > & cXmlExivEntry::Names()
{
return mNames;
}
const std::list< std::string > & cXmlExivEntry::Names()const
{
return mNames;
}
double & cXmlExivEntry::Focale()
{
return mFocale;
}
const double & cXmlExivEntry::Focale()const
{
return mFocale;
}
void BinaryUnDumpFromFile(cXmlExivEntry & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Names().push_back(aVal);
}
} ;
BinaryUnDumpFromFile(anObj.Focale(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlExivEntry & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.Names().size());
for( std::list< std::string >::const_iterator iT=anObj.Names().begin();
iT!=anObj.Names().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.Focale());
}
cElXMLTree * ToXMLTree(const cXmlExivEntry & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlExivEntry",eXMLBranche);
for
( std::list< std::string >::const_iterator it=anObj.Names().begin();
it !=anObj.Names().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Names"),(*it))->ReTagThis("Names"));
aRes->AddFils(::ToXMLTree(std::string("Focale"),anObj.Focale())->ReTagThis("Focale"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlExivEntry & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Names(),aTree->GetAll("Names",false,1));
xml_init(anObj.Focale(),aTree->Get("Focale",1)); //tototo
}
std::string Mangling( cXmlExivEntry *) {return "0C4C0FEBB27288FFFE3F";};
int & cXmlDataBase::MajNumVers()
{
return mMajNumVers;
}
const int & cXmlDataBase::MajNumVers()const
{
return mMajNumVers;
}
int & cXmlDataBase::MinNumVers()
{
return mMinNumVers;
}
const int & cXmlDataBase::MinNumVers()const
{
return mMinNumVers;
}
std::list< cXmlExivEntry > & cXmlDataBase::Exiv()
{
return mExiv;
}
const std::list< cXmlExivEntry > & cXmlDataBase::Exiv()const
{
return mExiv;
}
void BinaryUnDumpFromFile(cXmlDataBase & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.MajNumVers(),aFp);
BinaryUnDumpFromFile(anObj.MinNumVers(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cXmlExivEntry aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Exiv().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlDataBase & anObj)
{
BinaryDumpInFile(aFp,anObj.MajNumVers());
BinaryDumpInFile(aFp,anObj.MinNumVers());
BinaryDumpInFile(aFp,(int)anObj.Exiv().size());
for( std::list< cXmlExivEntry >::const_iterator iT=anObj.Exiv().begin();
iT!=anObj.Exiv().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cXmlDataBase & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlDataBase",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("MajNumVers"),anObj.MajNumVers())->ReTagThis("MajNumVers"));
aRes->AddFils(::ToXMLTree(std::string("MinNumVers"),anObj.MinNumVers())->ReTagThis("MinNumVers"));
for
( std::list< cXmlExivEntry >::const_iterator it=anObj.Exiv().begin();
it !=anObj.Exiv().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("Exiv"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlDataBase & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.MajNumVers(),aTree->Get("MajNumVers",1)); //tototo
xml_init(anObj.MinNumVers(),aTree->Get("MinNumVers",1)); //tototo
xml_init(anObj.Exiv(),aTree->GetAll("Exiv",false,1));
}
std::string Mangling( cXmlDataBase *) {return "5D80473B6933F396FE3F";};
std::string & cListImByDelta::KeySplitName()
{
return mKeySplitName;
}
const std::string & cListImByDelta::KeySplitName()const
{
return mKeySplitName;
}
std::list< int > & cListImByDelta::Delta()
{
return mDelta;
}
const std::list< int > & cListImByDelta::Delta()const
{
return mDelta;
}
void BinaryUnDumpFromFile(cListImByDelta & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.KeySplitName(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
int aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Delta().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cListImByDelta & anObj)
{
BinaryDumpInFile(aFp,anObj.KeySplitName());
BinaryDumpInFile(aFp,(int)anObj.Delta().size());
for( std::list< int >::const_iterator iT=anObj.Delta().begin();
iT!=anObj.Delta().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cListImByDelta & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"ListImByDelta",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("KeySplitName"),anObj.KeySplitName())->ReTagThis("KeySplitName"));
for
( std::list< int >::const_iterator it=anObj.Delta().begin();
it !=anObj.Delta().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Delta"),(*it))->ReTagThis("Delta"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cListImByDelta & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.KeySplitName(),aTree->Get("KeySplitName",1)); //tototo
xml_init(anObj.Delta(),aTree->GetAll("Delta",false,1));
}
std::string Mangling( cListImByDelta *) {return "83CD3120743E4599FF3F";};
cTplValGesInit< std::string > & cMMUserEnvironment::TiePDetect()
{
return mTiePDetect;
}
const cTplValGesInit< std::string > & cMMUserEnvironment::TiePDetect()const
{
return mTiePDetect;
}
cTplValGesInit< std::string > & cMMUserEnvironment::TiePMatch()
{
return mTiePMatch;
}
const cTplValGesInit< std::string > & cMMUserEnvironment::TiePMatch()const
{
return mTiePMatch;
}
cTplValGesInit< std::string > & cMMUserEnvironment::UserName()
{
return mUserName;
}
const cTplValGesInit< std::string > & cMMUserEnvironment::UserName()const
{
return mUserName;
}
cTplValGesInit< int > & cMMUserEnvironment::NbMaxProc()
{
return mNbMaxProc;
}
const cTplValGesInit< int > & cMMUserEnvironment::NbMaxProc()const
{
return mNbMaxProc;
}
cTplValGesInit< bool > & cMMUserEnvironment::UseSeparateDirectories()
{
return mUseSeparateDirectories;
}
const cTplValGesInit< bool > & cMMUserEnvironment::UseSeparateDirectories()const
{
return mUseSeparateDirectories;
}
cTplValGesInit< std::string > & cMMUserEnvironment::OutputDirectory()
{
return mOutputDirectory;
}
const cTplValGesInit< std::string > & cMMUserEnvironment::OutputDirectory()const
{
return mOutputDirectory;
}
cTplValGesInit< std::string > & cMMUserEnvironment::LogDirectory()
{
return mLogDirectory;
}
const cTplValGesInit< std::string > & cMMUserEnvironment::LogDirectory()const
{
return mLogDirectory;
}
cTplValGesInit< int > & cMMUserEnvironment::VersionNameCam()
{
return mVersionNameCam;
}
const cTplValGesInit< int > & cMMUserEnvironment::VersionNameCam()const
{
return mVersionNameCam;
}
void BinaryUnDumpFromFile(cMMUserEnvironment & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.TiePDetect().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.TiePDetect().ValForcedForUnUmp(),aFp);
}
else anObj.TiePDetect().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.TiePMatch().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.TiePMatch().ValForcedForUnUmp(),aFp);
}
else anObj.TiePMatch().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.UserName().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.UserName().ValForcedForUnUmp(),aFp);
}
else anObj.UserName().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.NbMaxProc().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.NbMaxProc().ValForcedForUnUmp(),aFp);
}
else anObj.NbMaxProc().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.UseSeparateDirectories().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.UseSeparateDirectories().ValForcedForUnUmp(),aFp);
}
else anObj.UseSeparateDirectories().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.OutputDirectory().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.OutputDirectory().ValForcedForUnUmp(),aFp);
}
else anObj.OutputDirectory().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.LogDirectory().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.LogDirectory().ValForcedForUnUmp(),aFp);
}
else anObj.LogDirectory().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.VersionNameCam().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.VersionNameCam().ValForcedForUnUmp(),aFp);
}
else anObj.VersionNameCam().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cMMUserEnvironment & anObj)
{
BinaryDumpInFile(aFp,anObj.TiePDetect().IsInit());
if (anObj.TiePDetect().IsInit()) BinaryDumpInFile(aFp,anObj.TiePDetect().Val());
BinaryDumpInFile(aFp,anObj.TiePMatch().IsInit());
if (anObj.TiePMatch().IsInit()) BinaryDumpInFile(aFp,anObj.TiePMatch().Val());
BinaryDumpInFile(aFp,anObj.UserName().IsInit());
if (anObj.UserName().IsInit()) BinaryDumpInFile(aFp,anObj.UserName().Val());
BinaryDumpInFile(aFp,anObj.NbMaxProc().IsInit());
if (anObj.NbMaxProc().IsInit()) BinaryDumpInFile(aFp,anObj.NbMaxProc().Val());
BinaryDumpInFile(aFp,anObj.UseSeparateDirectories().IsInit());
if (anObj.UseSeparateDirectories().IsInit()) BinaryDumpInFile(aFp,anObj.UseSeparateDirectories().Val());
BinaryDumpInFile(aFp,anObj.OutputDirectory().IsInit());
if (anObj.OutputDirectory().IsInit()) BinaryDumpInFile(aFp,anObj.OutputDirectory().Val());
BinaryDumpInFile(aFp,anObj.LogDirectory().IsInit());
if (anObj.LogDirectory().IsInit()) BinaryDumpInFile(aFp,anObj.LogDirectory().Val());
BinaryDumpInFile(aFp,anObj.VersionNameCam().IsInit());
if (anObj.VersionNameCam().IsInit()) BinaryDumpInFile(aFp,anObj.VersionNameCam().Val());
}
cElXMLTree * ToXMLTree(const cMMUserEnvironment & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"MMUserEnvironment",eXMLBranche);
if (anObj.TiePDetect().IsInit())
aRes->AddFils(::ToXMLTree(std::string("TiePDetect"),anObj.TiePDetect().Val())->ReTagThis("TiePDetect"));
if (anObj.TiePMatch().IsInit())
aRes->AddFils(::ToXMLTree(std::string("TiePMatch"),anObj.TiePMatch().Val())->ReTagThis("TiePMatch"));
if (anObj.UserName().IsInit())
aRes->AddFils(::ToXMLTree(std::string("UserName"),anObj.UserName().Val())->ReTagThis("UserName"));
if (anObj.NbMaxProc().IsInit())
aRes->AddFils(::ToXMLTree(std::string("NbMaxProc"),anObj.NbMaxProc().Val())->ReTagThis("NbMaxProc"));
if (anObj.UseSeparateDirectories().IsInit())
aRes->AddFils(::ToXMLTree(std::string("UseSeparateDirectories"),anObj.UseSeparateDirectories().Val())->ReTagThis("UseSeparateDirectories"));
if (anObj.OutputDirectory().IsInit())
aRes->AddFils(::ToXMLTree(std::string("OutputDirectory"),anObj.OutputDirectory().Val())->ReTagThis("OutputDirectory"));
if (anObj.LogDirectory().IsInit())
aRes->AddFils(::ToXMLTree(std::string("LogDirectory"),anObj.LogDirectory().Val())->ReTagThis("LogDirectory"));
if (anObj.VersionNameCam().IsInit())
aRes->AddFils(::ToXMLTree(std::string("VersionNameCam"),anObj.VersionNameCam().Val())->ReTagThis("VersionNameCam"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cMMUserEnvironment & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.TiePDetect(),aTree->Get("TiePDetect",1)); //tototo
xml_init(anObj.TiePMatch(),aTree->Get("TiePMatch",1)); //tototo
xml_init(anObj.UserName(),aTree->Get("UserName",1),std::string("Anonymous")); //tototo
xml_init(anObj.NbMaxProc(),aTree->Get("NbMaxProc",1),int(10000000)); //tototo
xml_init(anObj.UseSeparateDirectories(),aTree->Get("UseSeparateDirectories",1),bool(false)); //tototo
xml_init(anObj.OutputDirectory(),aTree->Get("OutputDirectory",1)); //tototo
xml_init(anObj.LogDirectory(),aTree->Get("LogDirectory",1)); //tototo
xml_init(anObj.VersionNameCam(),aTree->Get("VersionNameCam",1),int(1)); //tototo
}
std::string Mangling( cMMUserEnvironment *) {return "BD12249D67431BC5FE3F";};
Pt2di & cMTDCoher::Dec2()
{
return mDec2;
}
const Pt2di & cMTDCoher::Dec2()const
{
return mDec2;
}
void BinaryUnDumpFromFile(cMTDCoher & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Dec2(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cMTDCoher & anObj)
{
BinaryDumpInFile(aFp,anObj.Dec2());
}
cElXMLTree * ToXMLTree(const cMTDCoher & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"MTDCoher",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Dec2"),anObj.Dec2())->ReTagThis("Dec2"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cMTDCoher & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Dec2(),aTree->Get("Dec2",1)); //tototo
}
std::string Mangling( cMTDCoher *) {return "FB80FE2B97F96881FE3F";};
double & cXmlMatis_sommet::easting()
{
return measting;
}
const double & cXmlMatis_sommet::easting()const
{
return measting;
}
double & cXmlMatis_sommet::northing()
{
return mnorthing;
}
const double & cXmlMatis_sommet::northing()const
{
return mnorthing;
}
double & cXmlMatis_sommet::altitude()
{
return maltitude;
}
const double & cXmlMatis_sommet::altitude()const
{
return maltitude;
}
void BinaryUnDumpFromFile(cXmlMatis_sommet & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.easting(),aFp);
BinaryUnDumpFromFile(anObj.northing(),aFp);
BinaryUnDumpFromFile(anObj.altitude(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_sommet & anObj)
{
BinaryDumpInFile(aFp,anObj.easting());
BinaryDumpInFile(aFp,anObj.northing());
BinaryDumpInFile(aFp,anObj.altitude());
}
cElXMLTree * ToXMLTree(const cXmlMatis_sommet & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_sommet",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("easting"),anObj.easting())->ReTagThis("easting"));
aRes->AddFils(::ToXMLTree(std::string("northing"),anObj.northing())->ReTagThis("northing"));
aRes->AddFils(::ToXMLTree(std::string("altitude"),anObj.altitude())->ReTagThis("altitude"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_sommet & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.easting(),aTree->Get("easting",1)); //tototo
xml_init(anObj.northing(),aTree->Get("northing",1)); //tototo
xml_init(anObj.altitude(),aTree->Get("altitude",1)); //tototo
}
std::string Mangling( cXmlMatis_sommet *) {return "525B168200C4F492FF3F";};
double & cXmlMatis_pt3d::x()
{
return mx;
}
const double & cXmlMatis_pt3d::x()const
{
return mx;
}
double & cXmlMatis_pt3d::y()
{
return my;
}
const double & cXmlMatis_pt3d::y()const
{
return my;
}
double & cXmlMatis_pt3d::z()
{
return mz;
}
const double & cXmlMatis_pt3d::z()const
{
return mz;
}
void BinaryUnDumpFromFile(cXmlMatis_pt3d & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.x(),aFp);
BinaryUnDumpFromFile(anObj.y(),aFp);
BinaryUnDumpFromFile(anObj.z(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_pt3d & anObj)
{
BinaryDumpInFile(aFp,anObj.x());
BinaryDumpInFile(aFp,anObj.y());
BinaryDumpInFile(aFp,anObj.z());
}
cElXMLTree * ToXMLTree(const cXmlMatis_pt3d & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_pt3d",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("x"),anObj.x())->ReTagThis("x"));
aRes->AddFils(::ToXMLTree(std::string("y"),anObj.y())->ReTagThis("y"));
aRes->AddFils(::ToXMLTree(std::string("z"),anObj.z())->ReTagThis("z"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_pt3d & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.x(),aTree->Get("x",1)); //tototo
xml_init(anObj.y(),aTree->Get("y",1)); //tototo
xml_init(anObj.z(),aTree->Get("z",1)); //tototo
}
std::string Mangling( cXmlMatis_pt3d *) {return "FE8760809AA14AB4FD3F";};
cXmlMatis_pt3d & cXmlMatis_FormeLin::pt3d()
{
return mpt3d;
}
const cXmlMatis_pt3d & cXmlMatis_FormeLin::pt3d()const
{
return mpt3d;
}
void BinaryUnDumpFromFile(cXmlMatis_FormeLin & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.pt3d(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_FormeLin & anObj)
{
BinaryDumpInFile(aFp,anObj.pt3d());
}
cElXMLTree * ToXMLTree(const cXmlMatis_FormeLin & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_FormeLin",eXMLBranche);
aRes->AddFils(ToXMLTree(anObj.pt3d())->ReTagThis("pt3d"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_FormeLin & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.pt3d(),aTree->Get("pt3d",1)); //tototo
}
std::string Mangling( cXmlMatis_FormeLin *) {return "6C51835EFE29ADBBFF3F";};
cXmlMatis_FormeLin & cXmlMatis_mat3d::l1()
{
return ml1;
}
const cXmlMatis_FormeLin & cXmlMatis_mat3d::l1()const
{
return ml1;
}
cXmlMatis_FormeLin & cXmlMatis_mat3d::l2()
{
return ml2;
}
const cXmlMatis_FormeLin & cXmlMatis_mat3d::l2()const
{
return ml2;
}
cXmlMatis_FormeLin & cXmlMatis_mat3d::l3()
{
return ml3;
}
const cXmlMatis_FormeLin & cXmlMatis_mat3d::l3()const
{
return ml3;
}
void BinaryUnDumpFromFile(cXmlMatis_mat3d & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.l1(),aFp);
BinaryUnDumpFromFile(anObj.l2(),aFp);
BinaryUnDumpFromFile(anObj.l3(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_mat3d & anObj)
{
BinaryDumpInFile(aFp,anObj.l1());
BinaryDumpInFile(aFp,anObj.l2());
BinaryDumpInFile(aFp,anObj.l3());
}
cElXMLTree * ToXMLTree(const cXmlMatis_mat3d & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_mat3d",eXMLBranche);
aRes->AddFils(ToXMLTree(anObj.l1())->ReTagThis("l1"));
aRes->AddFils(ToXMLTree(anObj.l2())->ReTagThis("l2"));
aRes->AddFils(ToXMLTree(anObj.l3())->ReTagThis("l3"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_mat3d & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.l1(),aTree->Get("l1",1)); //tototo
xml_init(anObj.l2(),aTree->Get("l2",1)); //tototo
xml_init(anObj.l3(),aTree->Get("l3",1)); //tototo
}
std::string Mangling( cXmlMatis_mat3d *) {return "BB00ECAFEECC47FCFE3F";};
double & cXmlMatis_quaternion::x()
{
return mx;
}
const double & cXmlMatis_quaternion::x()const
{
return mx;
}
double & cXmlMatis_quaternion::y()
{
return my;
}
const double & cXmlMatis_quaternion::y()const
{
return my;
}
double & cXmlMatis_quaternion::z()
{
return mz;
}
const double & cXmlMatis_quaternion::z()const
{
return mz;
}
double & cXmlMatis_quaternion::w()
{
return mw;
}
const double & cXmlMatis_quaternion::w()const
{
return mw;
}
void BinaryUnDumpFromFile(cXmlMatis_quaternion & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.x(),aFp);
BinaryUnDumpFromFile(anObj.y(),aFp);
BinaryUnDumpFromFile(anObj.z(),aFp);
BinaryUnDumpFromFile(anObj.w(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_quaternion & anObj)
{
BinaryDumpInFile(aFp,anObj.x());
BinaryDumpInFile(aFp,anObj.y());
BinaryDumpInFile(aFp,anObj.z());
BinaryDumpInFile(aFp,anObj.w());
}
cElXMLTree * ToXMLTree(const cXmlMatis_quaternion & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_quaternion",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("x"),anObj.x())->ReTagThis("x"));
aRes->AddFils(::ToXMLTree(std::string("y"),anObj.y())->ReTagThis("y"));
aRes->AddFils(::ToXMLTree(std::string("z"),anObj.z())->ReTagThis("z"));
aRes->AddFils(::ToXMLTree(std::string("w"),anObj.w())->ReTagThis("w"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_quaternion & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.x(),aTree->Get("x",1)); //tototo
xml_init(anObj.y(),aTree->Get("y",1)); //tototo
xml_init(anObj.z(),aTree->Get("z",1)); //tototo
xml_init(anObj.w(),aTree->Get("w",1)); //tototo
}
std::string Mangling( cXmlMatis_quaternion *) {return "2C30033471BA78AEFE3F";};
bool & cXmlMatis_rotation::Image2Ground()
{
return mImage2Ground;
}
const bool & cXmlMatis_rotation::Image2Ground()const
{
return mImage2Ground;
}
cXmlMatis_mat3d & cXmlMatis_rotation::mat3d()
{
return mmat3d;
}
const cXmlMatis_mat3d & cXmlMatis_rotation::mat3d()const
{
return mmat3d;
}
cTplValGesInit< cXmlMatis_quaternion > & cXmlMatis_rotation::quaternion()
{
return mquaternion;
}
const cTplValGesInit< cXmlMatis_quaternion > & cXmlMatis_rotation::quaternion()const
{
return mquaternion;
}
void BinaryUnDumpFromFile(cXmlMatis_rotation & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Image2Ground(),aFp);
BinaryUnDumpFromFile(anObj.mat3d(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.quaternion().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.quaternion().ValForcedForUnUmp(),aFp);
}
else anObj.quaternion().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_rotation & anObj)
{
BinaryDumpInFile(aFp,anObj.Image2Ground());
BinaryDumpInFile(aFp,anObj.mat3d());
BinaryDumpInFile(aFp,anObj.quaternion().IsInit());
if (anObj.quaternion().IsInit()) BinaryDumpInFile(aFp,anObj.quaternion().Val());
}
cElXMLTree * ToXMLTree(const cXmlMatis_rotation & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_rotation",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Image2Ground"),anObj.Image2Ground())->ReTagThis("Image2Ground"));
aRes->AddFils(ToXMLTree(anObj.mat3d())->ReTagThis("mat3d"));
if (anObj.quaternion().IsInit())
aRes->AddFils(ToXMLTree(anObj.quaternion().Val())->ReTagThis("quaternion"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_rotation & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Image2Ground(),aTree->Get("Image2Ground",1)); //tototo
xml_init(anObj.mat3d(),aTree->Get("mat3d",1)); //tototo
xml_init(anObj.quaternion(),aTree->Get("quaternion",1)); //tototo
}
std::string Mangling( cXmlMatis_rotation *) {return "8CFA1B903E3A1AAAFE3F";};
std::string & cXmlMatis_extrinseque::systeme()
{
return msysteme;
}
const std::string & cXmlMatis_extrinseque::systeme()const
{
return msysteme;
}
std::string & cXmlMatis_extrinseque::grid_alti()
{
return mgrid_alti;
}
const std::string & cXmlMatis_extrinseque::grid_alti()const
{
return mgrid_alti;
}
cXmlMatis_sommet & cXmlMatis_extrinseque::sommet()
{
return msommet;
}
const cXmlMatis_sommet & cXmlMatis_extrinseque::sommet()const
{
return msommet;
}
cXmlMatis_rotation & cXmlMatis_extrinseque::rotation()
{
return mrotation;
}
const cXmlMatis_rotation & cXmlMatis_extrinseque::rotation()const
{
return mrotation;
}
void BinaryUnDumpFromFile(cXmlMatis_extrinseque & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.systeme(),aFp);
BinaryUnDumpFromFile(anObj.grid_alti(),aFp);
BinaryUnDumpFromFile(anObj.sommet(),aFp);
BinaryUnDumpFromFile(anObj.rotation(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_extrinseque & anObj)
{
BinaryDumpInFile(aFp,anObj.systeme());
BinaryDumpInFile(aFp,anObj.grid_alti());
BinaryDumpInFile(aFp,anObj.sommet());
BinaryDumpInFile(aFp,anObj.rotation());
}
cElXMLTree * ToXMLTree(const cXmlMatis_extrinseque & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_extrinseque",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("systeme"),anObj.systeme())->ReTagThis("systeme"));
aRes->AddFils(::ToXMLTree(std::string("grid_alti"),anObj.grid_alti())->ReTagThis("grid_alti"));
aRes->AddFils(ToXMLTree(anObj.sommet())->ReTagThis("sommet"));
aRes->AddFils(ToXMLTree(anObj.rotation())->ReTagThis("rotation"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_extrinseque & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.systeme(),aTree->Get("systeme",1)); //tototo
xml_init(anObj.grid_alti(),aTree->Get("grid_alti",1)); //tototo
xml_init(anObj.sommet(),aTree->Get("sommet",1)); //tototo
xml_init(anObj.rotation(),aTree->Get("rotation",1)); //tototo
}
std::string Mangling( cXmlMatis_extrinseque *) {return "6A9F44E76D4537E5FD3F";};
double & cXmlMatis_P2d_cl::c()
{
return mc;
}
const double & cXmlMatis_P2d_cl::c()const
{
return mc;
}
double & cXmlMatis_P2d_cl::l()
{
return ml;
}
const double & cXmlMatis_P2d_cl::l()const
{
return ml;
}
void BinaryUnDumpFromFile(cXmlMatis_P2d_cl & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.c(),aFp);
BinaryUnDumpFromFile(anObj.l(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_P2d_cl & anObj)
{
BinaryDumpInFile(aFp,anObj.c());
BinaryDumpInFile(aFp,anObj.l());
}
cElXMLTree * ToXMLTree(const cXmlMatis_P2d_cl & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_P2d_cl",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("c"),anObj.c())->ReTagThis("c"));
aRes->AddFils(::ToXMLTree(std::string("l"),anObj.l())->ReTagThis("l"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_P2d_cl & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.c(),aTree->Get("c",1)); //tototo
xml_init(anObj.l(),aTree->Get("l",1)); //tototo
}
std::string Mangling( cXmlMatis_P2d_cl *) {return "9A94D14710B4D5CAFC3F";};
double & cXmlMatis_ppa::c()
{
return mc;
}
const double & cXmlMatis_ppa::c()const
{
return mc;
}
double & cXmlMatis_ppa::l()
{
return ml;
}
const double & cXmlMatis_ppa::l()const
{
return ml;
}
double & cXmlMatis_ppa::focale()
{
return mfocale;
}
const double & cXmlMatis_ppa::focale()const
{
return mfocale;
}
void BinaryUnDumpFromFile(cXmlMatis_ppa & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.c(),aFp);
BinaryUnDumpFromFile(anObj.l(),aFp);
BinaryUnDumpFromFile(anObj.focale(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_ppa & anObj)
{
BinaryDumpInFile(aFp,anObj.c());
BinaryDumpInFile(aFp,anObj.l());
BinaryDumpInFile(aFp,anObj.focale());
}
cElXMLTree * ToXMLTree(const cXmlMatis_ppa & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_ppa",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("c"),anObj.c())->ReTagThis("c"));
aRes->AddFils(::ToXMLTree(std::string("l"),anObj.l())->ReTagThis("l"));
aRes->AddFils(::ToXMLTree(std::string("focale"),anObj.focale())->ReTagThis("focale"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_ppa & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.c(),aTree->Get("c",1)); //tototo
xml_init(anObj.l(),aTree->Get("l",1)); //tototo
xml_init(anObj.focale(),aTree->Get("focale",1)); //tototo
}
std::string Mangling( cXmlMatis_ppa *) {return "EE36097876691F92FF3F";};
cXmlMatis_P2d_cl & cXmlMatis_distortion::pps()
{
return mpps;
}
const cXmlMatis_P2d_cl & cXmlMatis_distortion::pps()const
{
return mpps;
}
double & cXmlMatis_distortion::r3()
{
return mr3;
}
const double & cXmlMatis_distortion::r3()const
{
return mr3;
}
double & cXmlMatis_distortion::r5()
{
return mr5;
}
const double & cXmlMatis_distortion::r5()const
{
return mr5;
}
double & cXmlMatis_distortion::r7()
{
return mr7;
}
const double & cXmlMatis_distortion::r7()const
{
return mr7;
}
void BinaryUnDumpFromFile(cXmlMatis_distortion & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.pps(),aFp);
BinaryUnDumpFromFile(anObj.r3(),aFp);
BinaryUnDumpFromFile(anObj.r5(),aFp);
BinaryUnDumpFromFile(anObj.r7(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_distortion & anObj)
{
BinaryDumpInFile(aFp,anObj.pps());
BinaryDumpInFile(aFp,anObj.r3());
BinaryDumpInFile(aFp,anObj.r5());
BinaryDumpInFile(aFp,anObj.r7());
}
cElXMLTree * ToXMLTree(const cXmlMatis_distortion & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_distortion",eXMLBranche);
aRes->AddFils(ToXMLTree(anObj.pps())->ReTagThis("pps"));
aRes->AddFils(::ToXMLTree(std::string("r3"),anObj.r3())->ReTagThis("r3"));
aRes->AddFils(::ToXMLTree(std::string("r5"),anObj.r5())->ReTagThis("r5"));
aRes->AddFils(::ToXMLTree(std::string("r7"),anObj.r7())->ReTagThis("r7"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_distortion & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.pps(),aTree->Get("pps",1)); //tototo
xml_init(anObj.r3(),aTree->Get("r3",1)); //tototo
xml_init(anObj.r5(),aTree->Get("r5",1)); //tototo
xml_init(anObj.r7(),aTree->Get("r7",1)); //tototo
}
std::string Mangling( cXmlMatis_distortion *) {return "9DCB31066D6B2FC0FF3F";};
int & cXmlMatis_image_size::width()
{
return mwidth;
}
const int & cXmlMatis_image_size::width()const
{
return mwidth;
}
int & cXmlMatis_image_size::height()
{
return mheight;
}
const int & cXmlMatis_image_size::height()const
{
return mheight;
}
void BinaryUnDumpFromFile(cXmlMatis_image_size & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.width(),aFp);
BinaryUnDumpFromFile(anObj.height(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_image_size & anObj)
{
BinaryDumpInFile(aFp,anObj.width());
BinaryDumpInFile(aFp,anObj.height());
}
cElXMLTree * ToXMLTree(const cXmlMatis_image_size & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_image_size",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("width"),anObj.width())->ReTagThis("width"));
aRes->AddFils(::ToXMLTree(std::string("height"),anObj.height())->ReTagThis("height"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_image_size & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.width(),aTree->Get("width",1)); //tototo
xml_init(anObj.height(),aTree->Get("height",1)); //tototo
}
std::string Mangling( cXmlMatis_image_size *) {return "C82FD02A5EE940B4FE3F";};
std::string & cXmlMatis_sensor::name()
{
return mname;
}
const std::string & cXmlMatis_sensor::name()const
{
return mname;
}
std::string & cXmlMatis_sensor::calibration_date()
{
return mcalibration_date;
}
const std::string & cXmlMatis_sensor::calibration_date()const
{
return mcalibration_date;
}
std::string & cXmlMatis_sensor::serial_number()
{
return mserial_number;
}
const std::string & cXmlMatis_sensor::serial_number()const
{
return mserial_number;
}
cXmlMatis_image_size & cXmlMatis_sensor::image_size()
{
return mimage_size;
}
const cXmlMatis_image_size & cXmlMatis_sensor::image_size()const
{
return mimage_size;
}
cXmlMatis_ppa & cXmlMatis_sensor::ppa()
{
return mppa;
}
const cXmlMatis_ppa & cXmlMatis_sensor::ppa()const
{
return mppa;
}
cXmlMatis_distortion & cXmlMatis_sensor::distortion()
{
return mdistortion;
}
const cXmlMatis_distortion & cXmlMatis_sensor::distortion()const
{
return mdistortion;
}
double & cXmlMatis_sensor::pixel_size()
{
return mpixel_size;
}
const double & cXmlMatis_sensor::pixel_size()const
{
return mpixel_size;
}
void BinaryUnDumpFromFile(cXmlMatis_sensor & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.name(),aFp);
BinaryUnDumpFromFile(anObj.calibration_date(),aFp);
BinaryUnDumpFromFile(anObj.serial_number(),aFp);
BinaryUnDumpFromFile(anObj.image_size(),aFp);
BinaryUnDumpFromFile(anObj.ppa(),aFp);
BinaryUnDumpFromFile(anObj.distortion(),aFp);
BinaryUnDumpFromFile(anObj.pixel_size(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_sensor & anObj)
{
BinaryDumpInFile(aFp,anObj.name());
BinaryDumpInFile(aFp,anObj.calibration_date());
BinaryDumpInFile(aFp,anObj.serial_number());
BinaryDumpInFile(aFp,anObj.image_size());
BinaryDumpInFile(aFp,anObj.ppa());
BinaryDumpInFile(aFp,anObj.distortion());
BinaryDumpInFile(aFp,anObj.pixel_size());
}
cElXMLTree * ToXMLTree(const cXmlMatis_sensor & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_sensor",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("name"),anObj.name())->ReTagThis("name"));
aRes->AddFils(::ToXMLTree(std::string("calibration_date"),anObj.calibration_date())->ReTagThis("calibration_date"));
aRes->AddFils(::ToXMLTree(std::string("serial_number"),anObj.serial_number())->ReTagThis("serial_number"));
aRes->AddFils(ToXMLTree(anObj.image_size())->ReTagThis("image_size"));
aRes->AddFils(ToXMLTree(anObj.ppa())->ReTagThis("ppa"));
aRes->AddFils(ToXMLTree(anObj.distortion())->ReTagThis("distortion"));
aRes->AddFils(::ToXMLTree(std::string("pixel_size"),anObj.pixel_size())->ReTagThis("pixel_size"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_sensor & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.name(),aTree->Get("name",1)); //tototo
xml_init(anObj.calibration_date(),aTree->Get("calibration_date",1)); //tototo
xml_init(anObj.serial_number(),aTree->Get("serial_number",1)); //tototo
xml_init(anObj.image_size(),aTree->Get("image_size",1)); //tototo
xml_init(anObj.ppa(),aTree->Get("ppa",1)); //tototo
xml_init(anObj.distortion(),aTree->Get("distortion",1)); //tototo
xml_init(anObj.pixel_size(),aTree->Get("pixel_size",1)); //tototo
}
std::string Mangling( cXmlMatis_sensor *) {return "1405F79A1BD6DEE2FE3F";};
double & cXmlMatis_frame::lambda_min()
{
return mlambda_min;
}
const double & cXmlMatis_frame::lambda_min()const
{
return mlambda_min;
}
double & cXmlMatis_frame::lambda_max()
{
return mlambda_max;
}
const double & cXmlMatis_frame::lambda_max()const
{
return mlambda_max;
}
double & cXmlMatis_frame::phi_min()
{
return mphi_min;
}
const double & cXmlMatis_frame::phi_min()const
{
return mphi_min;
}
double & cXmlMatis_frame::phi_max()
{
return mphi_max;
}
const double & cXmlMatis_frame::phi_max()const
{
return mphi_max;
}
void BinaryUnDumpFromFile(cXmlMatis_frame & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.lambda_min(),aFp);
BinaryUnDumpFromFile(anObj.lambda_max(),aFp);
BinaryUnDumpFromFile(anObj.phi_min(),aFp);
BinaryUnDumpFromFile(anObj.phi_max(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_frame & anObj)
{
BinaryDumpInFile(aFp,anObj.lambda_min());
BinaryDumpInFile(aFp,anObj.lambda_max());
BinaryDumpInFile(aFp,anObj.phi_min());
BinaryDumpInFile(aFp,anObj.phi_max());
}
cElXMLTree * ToXMLTree(const cXmlMatis_frame & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_frame",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("lambda_min"),anObj.lambda_min())->ReTagThis("lambda_min"));
aRes->AddFils(::ToXMLTree(std::string("lambda_max"),anObj.lambda_max())->ReTagThis("lambda_max"));
aRes->AddFils(::ToXMLTree(std::string("phi_min"),anObj.phi_min())->ReTagThis("phi_min"));
aRes->AddFils(::ToXMLTree(std::string("phi_max"),anObj.phi_max())->ReTagThis("phi_max"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_frame & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.lambda_min(),aTree->Get("lambda_min",1)); //tototo
xml_init(anObj.lambda_max(),aTree->Get("lambda_max",1)); //tototo
xml_init(anObj.phi_min(),aTree->Get("phi_min",1)); //tototo
xml_init(anObj.phi_max(),aTree->Get("phi_max",1)); //tototo
}
std::string Mangling( cXmlMatis_frame *) {return "ECF910315C7EF5EAFE3F";};
cXmlMatis_image_size & cXmlMatis_spherique::image_size()
{
return mimage_size;
}
const cXmlMatis_image_size & cXmlMatis_spherique::image_size()const
{
return mimage_size;
}
cXmlMatis_P2d_cl & cXmlMatis_spherique::ppa()
{
return mppa;
}
const cXmlMatis_P2d_cl & cXmlMatis_spherique::ppa()const
{
return mppa;
}
cXmlMatis_frame & cXmlMatis_spherique::frame()
{
return mframe;
}
const cXmlMatis_frame & cXmlMatis_spherique::frame()const
{
return mframe;
}
void BinaryUnDumpFromFile(cXmlMatis_spherique & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.image_size(),aFp);
BinaryUnDumpFromFile(anObj.ppa(),aFp);
BinaryUnDumpFromFile(anObj.frame(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_spherique & anObj)
{
BinaryDumpInFile(aFp,anObj.image_size());
BinaryDumpInFile(aFp,anObj.ppa());
BinaryDumpInFile(aFp,anObj.frame());
}
cElXMLTree * ToXMLTree(const cXmlMatis_spherique & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_spherique",eXMLBranche);
aRes->AddFils(ToXMLTree(anObj.image_size())->ReTagThis("image_size"));
aRes->AddFils(ToXMLTree(anObj.ppa())->ReTagThis("ppa"));
aRes->AddFils(ToXMLTree(anObj.frame())->ReTagThis("frame"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_spherique & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.image_size(),aTree->Get("image_size",1)); //tototo
xml_init(anObj.ppa(),aTree->Get("ppa",1)); //tototo
xml_init(anObj.frame(),aTree->Get("frame",1)); //tototo
}
std::string Mangling( cXmlMatis_spherique *) {return "C84CD843CAC998EBFD3F";};
cTplValGesInit< cXmlMatis_sensor > & cXmlMatis_intrinseque::sensor()
{
return msensor;
}
const cTplValGesInit< cXmlMatis_sensor > & cXmlMatis_intrinseque::sensor()const
{
return msensor;
}
cTplValGesInit< cXmlMatis_spherique > & cXmlMatis_intrinseque::spherique()
{
return mspherique;
}
const cTplValGesInit< cXmlMatis_spherique > & cXmlMatis_intrinseque::spherique()const
{
return mspherique;
}
void BinaryUnDumpFromFile(cXmlMatis_intrinseque & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.sensor().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.sensor().ValForcedForUnUmp(),aFp);
}
else anObj.sensor().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.spherique().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.spherique().ValForcedForUnUmp(),aFp);
}
else anObj.spherique().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_intrinseque & anObj)
{
BinaryDumpInFile(aFp,anObj.sensor().IsInit());
if (anObj.sensor().IsInit()) BinaryDumpInFile(aFp,anObj.sensor().Val());
BinaryDumpInFile(aFp,anObj.spherique().IsInit());
if (anObj.spherique().IsInit()) BinaryDumpInFile(aFp,anObj.spherique().Val());
}
cElXMLTree * ToXMLTree(const cXmlMatis_intrinseque & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_intrinseque",eXMLBranche);
if (anObj.sensor().IsInit())
aRes->AddFils(ToXMLTree(anObj.sensor().Val())->ReTagThis("sensor"));
if (anObj.spherique().IsInit())
aRes->AddFils(ToXMLTree(anObj.spherique().Val())->ReTagThis("spherique"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_intrinseque & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.sensor(),aTree->Get("sensor",1)); //tototo
xml_init(anObj.spherique(),aTree->Get("spherique",1)); //tototo
}
std::string Mangling( cXmlMatis_intrinseque *) {return "427AE09C1C4B84D1FE3F";};
cXmlMatis_extrinseque & cXmlMatis_geometry::extrinseque()
{
return mextrinseque;
}
const cXmlMatis_extrinseque & cXmlMatis_geometry::extrinseque()const
{
return mextrinseque;
}
cXmlMatis_intrinseque & cXmlMatis_geometry::intrinseque()
{
return mintrinseque;
}
const cXmlMatis_intrinseque & cXmlMatis_geometry::intrinseque()const
{
return mintrinseque;
}
void BinaryUnDumpFromFile(cXmlMatis_geometry & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.extrinseque(),aFp);
BinaryUnDumpFromFile(anObj.intrinseque(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_geometry & anObj)
{
BinaryDumpInFile(aFp,anObj.extrinseque());
BinaryDumpInFile(aFp,anObj.intrinseque());
}
cElXMLTree * ToXMLTree(const cXmlMatis_geometry & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_geometry",eXMLBranche);
aRes->AddFils(ToXMLTree(anObj.extrinseque())->ReTagThis("extrinseque"));
aRes->AddFils(ToXMLTree(anObj.intrinseque())->ReTagThis("intrinseque"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_geometry & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.extrinseque(),aTree->Get("extrinseque",1)); //tototo
xml_init(anObj.intrinseque(),aTree->Get("intrinseque",1)); //tototo
}
std::string Mangling( cXmlMatis_geometry *) {return "D71146A536B67EB7FD3F";};
int & cXmlMatis_image_date::year()
{
return myear;
}
const int & cXmlMatis_image_date::year()const
{
return myear;
}
int & cXmlMatis_image_date::month()
{
return mmonth;
}
const int & cXmlMatis_image_date::month()const
{
return mmonth;
}
int & cXmlMatis_image_date::day()
{
return mday;
}
const int & cXmlMatis_image_date::day()const
{
return mday;
}
std::string & cXmlMatis_image_date::time_system()
{
return mtime_system;
}
const std::string & cXmlMatis_image_date::time_system()const
{
return mtime_system;
}
int & cXmlMatis_image_date::hour()
{
return mhour;
}
const int & cXmlMatis_image_date::hour()const
{
return mhour;
}
int & cXmlMatis_image_date::minute()
{
return mminute;
}
const int & cXmlMatis_image_date::minute()const
{
return mminute;
}
double & cXmlMatis_image_date::second()
{
return msecond;
}
const double & cXmlMatis_image_date::second()const
{
return msecond;
}
void BinaryUnDumpFromFile(cXmlMatis_image_date & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.year(),aFp);
BinaryUnDumpFromFile(anObj.month(),aFp);
BinaryUnDumpFromFile(anObj.day(),aFp);
BinaryUnDumpFromFile(anObj.time_system(),aFp);
BinaryUnDumpFromFile(anObj.hour(),aFp);
BinaryUnDumpFromFile(anObj.minute(),aFp);
BinaryUnDumpFromFile(anObj.second(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_image_date & anObj)
{
BinaryDumpInFile(aFp,anObj.year());
BinaryDumpInFile(aFp,anObj.month());
BinaryDumpInFile(aFp,anObj.day());
BinaryDumpInFile(aFp,anObj.time_system());
BinaryDumpInFile(aFp,anObj.hour());
BinaryDumpInFile(aFp,anObj.minute());
BinaryDumpInFile(aFp,anObj.second());
}
cElXMLTree * ToXMLTree(const cXmlMatis_image_date & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_image_date",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("year"),anObj.year())->ReTagThis("year"));
aRes->AddFils(::ToXMLTree(std::string("month"),anObj.month())->ReTagThis("month"));
aRes->AddFils(::ToXMLTree(std::string("day"),anObj.day())->ReTagThis("day"));
aRes->AddFils(::ToXMLTree(std::string("time_system"),anObj.time_system())->ReTagThis("time_system"));
aRes->AddFils(::ToXMLTree(std::string("hour"),anObj.hour())->ReTagThis("hour"));
aRes->AddFils(::ToXMLTree(std::string("minute"),anObj.minute())->ReTagThis("minute"));
aRes->AddFils(::ToXMLTree(std::string("second"),anObj.second())->ReTagThis("second"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_image_date & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.year(),aTree->Get("year",1)); //tototo
xml_init(anObj.month(),aTree->Get("month",1)); //tototo
xml_init(anObj.day(),aTree->Get("day",1)); //tototo
xml_init(anObj.time_system(),aTree->Get("time_system",1)); //tototo
xml_init(anObj.hour(),aTree->Get("hour",1)); //tototo
xml_init(anObj.minute(),aTree->Get("minute",1)); //tototo
xml_init(anObj.second(),aTree->Get("second",1)); //tototo
}
std::string Mangling( cXmlMatis_image_date *) {return "76E17B9F8B4ABCA7FDBF";};
std::string & cXmlMatis_auxiliarydata::image_name()
{
return mimage_name;
}
const std::string & cXmlMatis_auxiliarydata::image_name()const
{
return mimage_name;
}
XmlXml & cXmlMatis_auxiliarydata::stereopolis()
{
return mstereopolis;
}
const XmlXml & cXmlMatis_auxiliarydata::stereopolis()const
{
return mstereopolis;
}
cXmlMatis_image_date & cXmlMatis_auxiliarydata::image_date()
{
return mimage_date;
}
const cXmlMatis_image_date & cXmlMatis_auxiliarydata::image_date()const
{
return mimage_date;
}
void BinaryUnDumpFromFile(cXmlMatis_auxiliarydata & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.image_name(),aFp);
BinaryUnDumpFromFile(anObj.stereopolis(),aFp);
BinaryUnDumpFromFile(anObj.image_date(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXmlMatis_auxiliarydata & anObj)
{
BinaryDumpInFile(aFp,anObj.image_name());
BinaryDumpInFile(aFp,anObj.stereopolis());
BinaryDumpInFile(aFp,anObj.image_date());
}
cElXMLTree * ToXMLTree(const cXmlMatis_auxiliarydata & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"XmlMatis_auxiliarydata",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("image_name"),anObj.image_name())->ReTagThis("image_name"));
aRes->AddFils(::ToXMLTree(std::string("stereopolis"),anObj.stereopolis())->ReTagThis("stereopolis"));
aRes->AddFils(ToXMLTree(anObj.image_date())->ReTagThis("image_date"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXmlMatis_auxiliarydata & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.image_name(),aTree->Get("image_name",1)); //tototo
xml_init(anObj.stereopolis(),aTree->Get("stereopolis",1)); //tototo
xml_init(anObj.image_date(),aTree->Get("image_date",1)); //tototo
}
std::string Mangling( cXmlMatis_auxiliarydata *) {return "719D9EE0F04ABA92FF3F";};
cTplValGesInit< std::string > & corientation::version()
{
return mversion;
}
const cTplValGesInit< std::string > & corientation::version()const
{
return mversion;
}
cXmlMatis_auxiliarydata & corientation::auxiliarydata()
{
return mauxiliarydata;
}
const cXmlMatis_auxiliarydata & corientation::auxiliarydata()const
{
return mauxiliarydata;
}
cXmlMatis_geometry & corientation::geometry()
{
return mgeometry;
}
const cXmlMatis_geometry & corientation::geometry()const
{
return mgeometry;
}
void BinaryUnDumpFromFile(corientation & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.version().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.version().ValForcedForUnUmp(),aFp);
}
else anObj.version().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.auxiliarydata(),aFp);
BinaryUnDumpFromFile(anObj.geometry(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const corientation & anObj)
{
BinaryDumpInFile(aFp,anObj.version().IsInit());
if (anObj.version().IsInit()) BinaryDumpInFile(aFp,anObj.version().Val());
BinaryDumpInFile(aFp,anObj.auxiliarydata());
BinaryDumpInFile(aFp,anObj.geometry());
}
cElXMLTree * ToXMLTree(const corientation & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"orientation",eXMLBranche);
if (anObj.version().IsInit())
aRes->AddFils(::ToXMLTree(std::string("version"),anObj.version().Val())->ReTagThis("version"));
aRes->AddFils(ToXMLTree(anObj.auxiliarydata())->ReTagThis("auxiliarydata"));
aRes->AddFils(ToXMLTree(anObj.geometry())->ReTagThis("geometry"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(corientation & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.version(),aTree->Get("version",1),std::string("1.0")); //tototo
xml_init(anObj.auxiliarydata(),aTree->Get("auxiliarydata",1)); //tototo
xml_init(anObj.geometry(),aTree->Get("geometry",1)); //tototo
}
std::string Mangling( corientation *) {return "DF7FA3370998EAE8FD3F";};
eTypeDynVino Str2eTypeDynVino(const std::string & aName)
{
if (aName=="eDynVinoModulo")
return eDynVinoModulo;
else if (aName=="eDynVinoColCirc")
return eDynVinoColCirc;
else if (aName=="eDynVinoMaxMin")
return eDynVinoMaxMin;
else if (aName=="eDynVinoStat2")
return eDynVinoStat2;
else if (aName=="eDynVinoEqual")
return eDynVinoEqual;
else if (aName=="eDynVinoNbVals")
return eDynVinoNbVals;
else
{
cout << aName << " is not a correct value for enum eTypeDynVino\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eTypeDynVino) 0;
}
void xml_init(eTypeDynVino & aVal,cElXMLTree * aTree)
{
aVal= Str2eTypeDynVino(aTree->Contenu());
}
std::string eToString(const eTypeDynVino & anObj)
{
if (anObj==eDynVinoModulo)
return "eDynVinoModulo";
if (anObj==eDynVinoColCirc)
return "eDynVinoColCirc";
if (anObj==eDynVinoMaxMin)
return "eDynVinoMaxMin";
if (anObj==eDynVinoStat2)
return "eDynVinoStat2";
if (anObj==eDynVinoEqual)
return "eDynVinoEqual";
if (anObj==eDynVinoNbVals)
return "eDynVinoNbVals";
std::cout << "Enum = eTypeDynVino\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eTypeDynVino & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eTypeDynVino & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eTypeDynVino & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eTypeDynVino) aIVal;
}
std::string Mangling( eTypeDynVino *) {return "432509112C16FD9DFE3F";};
std::string & cXml_StatVino::NameFile()
{
return mNameFile;
}
const std::string & cXml_StatVino::NameFile()const
{
return mNameFile;
}
eTypeDynVino & cXml_StatVino::Type()
{
return mType;
}
const eTypeDynVino & cXml_StatVino::Type()const
{
return mType;
}
bool & cXml_StatVino::IsInit()
{
return mIsInit;
}
const bool & cXml_StatVino::IsInit()const
{
return mIsInit;
}
double & cXml_StatVino::Nb()
{
return mNb;
}
const double & cXml_StatVino::Nb()const
{
return mNb;
}
std::vector< double > & cXml_StatVino::Soms()
{
return mSoms;
}
const std::vector< double > & cXml_StatVino::Soms()const
{
return mSoms;
}
std::vector< double > & cXml_StatVino::Soms2()
{
return mSoms2;
}
const std::vector< double > & cXml_StatVino::Soms2()const
{
return mSoms2;
}
std::vector< double > & cXml_StatVino::ECT()
{
return mECT;
}
const std::vector< double > & cXml_StatVino::ECT()const
{
return mECT;
}
std::vector< double > & cXml_StatVino::VMax()
{
return mVMax;
}
const std::vector< double > & cXml_StatVino::VMax()const
{
return mVMax;
}
std::vector< double > & cXml_StatVino::VMin()
{
return mVMin;
}
const std::vector< double > & cXml_StatVino::VMin()const
{
return mVMin;
}
Pt2dr & cXml_StatVino::IntervDyn()
{
return mIntervDyn;
}
const Pt2dr & cXml_StatVino::IntervDyn()const
{
return mIntervDyn;
}
double & cXml_StatVino::MulDyn()
{
return mMulDyn;
}
const double & cXml_StatVino::MulDyn()const
{
return mMulDyn;
}
double & cXml_StatVino::VMinHisto()
{
return mVMinHisto;
}
const double & cXml_StatVino::VMinHisto()const
{
return mVMinHisto;
}
double & cXml_StatVino::StepHisto()
{
return mStepHisto;
}
const double & cXml_StatVino::StepHisto()const
{
return mStepHisto;
}
void BinaryUnDumpFromFile(cXml_StatVino & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.NameFile(),aFp);
BinaryUnDumpFromFile(anObj.Type(),aFp);
BinaryUnDumpFromFile(anObj.IsInit(),aFp);
BinaryUnDumpFromFile(anObj.Nb(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
double aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Soms().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
double aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Soms2().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
double aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ECT().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
double aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.VMax().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
double aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.VMin().push_back(aVal);
}
} ;
BinaryUnDumpFromFile(anObj.IntervDyn(),aFp);
BinaryUnDumpFromFile(anObj.MulDyn(),aFp);
BinaryUnDumpFromFile(anObj.VMinHisto(),aFp);
BinaryUnDumpFromFile(anObj.StepHisto(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXml_StatVino & anObj)
{
BinaryDumpInFile(aFp,anObj.NameFile());
BinaryDumpInFile(aFp,anObj.Type());
BinaryDumpInFile(aFp,anObj.IsInit());
BinaryDumpInFile(aFp,anObj.Nb());
BinaryDumpInFile(aFp,(int)anObj.Soms().size());
for( std::vector< double >::const_iterator iT=anObj.Soms().begin();
iT!=anObj.Soms().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.Soms2().size());
for( std::vector< double >::const_iterator iT=anObj.Soms2().begin();
iT!=anObj.Soms2().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.ECT().size());
for( std::vector< double >::const_iterator iT=anObj.ECT().begin();
iT!=anObj.ECT().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.VMax().size());
for( std::vector< double >::const_iterator iT=anObj.VMax().begin();
iT!=anObj.VMax().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.VMin().size());
for( std::vector< double >::const_iterator iT=anObj.VMin().begin();
iT!=anObj.VMin().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.IntervDyn());
BinaryDumpInFile(aFp,anObj.MulDyn());
BinaryDumpInFile(aFp,anObj.VMinHisto());
BinaryDumpInFile(aFp,anObj.StepHisto());
}
cElXMLTree * ToXMLTree(const cXml_StatVino & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"Xml_StatVino",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("NameFile"),anObj.NameFile())->ReTagThis("NameFile"));
aRes->AddFils(ToXMLTree(std::string("Type"),anObj.Type())->ReTagThis("Type"));
aRes->AddFils(::ToXMLTree(std::string("IsInit"),anObj.IsInit())->ReTagThis("IsInit"));
aRes->AddFils(::ToXMLTree(std::string("Nb"),anObj.Nb())->ReTagThis("Nb"));
for
( std::vector< double >::const_iterator it=anObj.Soms().begin();
it !=anObj.Soms().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Soms"),(*it))->ReTagThis("Soms"));
for
( std::vector< double >::const_iterator it=anObj.Soms2().begin();
it !=anObj.Soms2().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Soms2"),(*it))->ReTagThis("Soms2"));
for
( std::vector< double >::const_iterator it=anObj.ECT().begin();
it !=anObj.ECT().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("ECT"),(*it))->ReTagThis("ECT"));
for
( std::vector< double >::const_iterator it=anObj.VMax().begin();
it !=anObj.VMax().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("VMax"),(*it))->ReTagThis("VMax"));
for
( std::vector< double >::const_iterator it=anObj.VMin().begin();
it !=anObj.VMin().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("VMin"),(*it))->ReTagThis("VMin"));
aRes->AddFils(::ToXMLTree(std::string("IntervDyn"),anObj.IntervDyn())->ReTagThis("IntervDyn"));
aRes->AddFils(::ToXMLTree(std::string("MulDyn"),anObj.MulDyn())->ReTagThis("MulDyn"));
aRes->AddFils(::ToXMLTree(std::string("VMinHisto"),anObj.VMinHisto())->ReTagThis("VMinHisto"));
aRes->AddFils(::ToXMLTree(std::string("StepHisto"),anObj.StepHisto())->ReTagThis("StepHisto"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXml_StatVino & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameFile(),aTree->Get("NameFile",1)); //tototo
xml_init(anObj.Type(),aTree->Get("Type",1)); //tototo
xml_init(anObj.IsInit(),aTree->Get("IsInit",1)); //tototo
xml_init(anObj.Nb(),aTree->Get("Nb",1)); //tototo
xml_init(anObj.Soms(),aTree->GetAll("Soms",false,1));
xml_init(anObj.Soms2(),aTree->GetAll("Soms2",false,1));
xml_init(anObj.ECT(),aTree->GetAll("ECT",false,1));
xml_init(anObj.VMax(),aTree->GetAll("VMax",false,1));
xml_init(anObj.VMin(),aTree->GetAll("VMin",false,1));
xml_init(anObj.IntervDyn(),aTree->Get("IntervDyn",1)); //tototo
xml_init(anObj.MulDyn(),aTree->Get("MulDyn",1)); //tototo
xml_init(anObj.VMinHisto(),aTree->Get("VMinHisto",1)); //tototo
xml_init(anObj.StepHisto(),aTree->Get("StepHisto",1)); //tototo
}
std::string Mangling( cXml_StatVino *) {return "2822970BEF4C09FDFE3F";};
Pt2di & cXml_EnvVino::SzW()
{
return mSzW;
}
const Pt2di & cXml_EnvVino::SzW()const
{
return mSzW;
}
cTplValGesInit< double > & cXml_EnvVino::SzLimSsEch()
{
return mSzLimSsEch;
}
const cTplValGesInit< double > & cXml_EnvVino::SzLimSsEch()const
{
return mSzLimSsEch;
}
int & cXml_EnvVino::LargAsc()
{
return mLargAsc;
}
const int & cXml_EnvVino::LargAsc()const
{
return mLargAsc;
}
Pt2di & cXml_EnvVino::SzIncr()
{
return mSzIncr;
}
const Pt2di & cXml_EnvVino::SzIncr()const
{
return mSzIncr;
}
bool & cXml_EnvVino::ZoomBilin()
{
return mZoomBilin;
}
const bool & cXml_EnvVino::ZoomBilin()const
{
return mZoomBilin;
}
double & cXml_EnvVino::SpeedZoomGrab()
{
return mSpeedZoomGrab;
}
const double & cXml_EnvVino::SpeedZoomGrab()const
{
return mSpeedZoomGrab;
}
double & cXml_EnvVino::SpeedZoomMolette()
{
return mSpeedZoomMolette;
}
const double & cXml_EnvVino::SpeedZoomMolette()const
{
return mSpeedZoomMolette;
}
bool & cXml_EnvVino::ForceGray()
{
return mForceGray;
}
const bool & cXml_EnvVino::ForceGray()const
{
return mForceGray;
}
int & cXml_EnvVino::NumCrop()
{
return mNumCrop;
}
const int & cXml_EnvVino::NumCrop()const
{
return mNumCrop;
}
std::list< cXml_StatVino > & cXml_EnvVino::Stats()
{
return mStats;
}
const std::list< cXml_StatVino > & cXml_EnvVino::Stats()const
{
return mStats;
}
void BinaryUnDumpFromFile(cXml_EnvVino & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.SzW(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.SzLimSsEch().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.SzLimSsEch().ValForcedForUnUmp(),aFp);
}
else anObj.SzLimSsEch().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.LargAsc(),aFp);
BinaryUnDumpFromFile(anObj.SzIncr(),aFp);
BinaryUnDumpFromFile(anObj.ZoomBilin(),aFp);
BinaryUnDumpFromFile(anObj.SpeedZoomGrab(),aFp);
BinaryUnDumpFromFile(anObj.SpeedZoomMolette(),aFp);
BinaryUnDumpFromFile(anObj.ForceGray(),aFp);
BinaryUnDumpFromFile(anObj.NumCrop(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cXml_StatVino aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Stats().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXml_EnvVino & anObj)
{
BinaryDumpInFile(aFp,anObj.SzW());
BinaryDumpInFile(aFp,anObj.SzLimSsEch().IsInit());
if (anObj.SzLimSsEch().IsInit()) BinaryDumpInFile(aFp,anObj.SzLimSsEch().Val());
BinaryDumpInFile(aFp,anObj.LargAsc());
BinaryDumpInFile(aFp,anObj.SzIncr());
BinaryDumpInFile(aFp,anObj.ZoomBilin());
BinaryDumpInFile(aFp,anObj.SpeedZoomGrab());
BinaryDumpInFile(aFp,anObj.SpeedZoomMolette());
BinaryDumpInFile(aFp,anObj.ForceGray());
BinaryDumpInFile(aFp,anObj.NumCrop());
BinaryDumpInFile(aFp,(int)anObj.Stats().size());
for( std::list< cXml_StatVino >::const_iterator iT=anObj.Stats().begin();
iT!=anObj.Stats().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cXml_EnvVino & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"Xml_EnvVino",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("SzW"),anObj.SzW())->ReTagThis("SzW"));
if (anObj.SzLimSsEch().IsInit())
aRes->AddFils(::ToXMLTree(std::string("SzLimSsEch"),anObj.SzLimSsEch().Val())->ReTagThis("SzLimSsEch"));
aRes->AddFils(::ToXMLTree(std::string("LargAsc"),anObj.LargAsc())->ReTagThis("LargAsc"));
aRes->AddFils(::ToXMLTree(std::string("SzIncr"),anObj.SzIncr())->ReTagThis("SzIncr"));
aRes->AddFils(::ToXMLTree(std::string("ZoomBilin"),anObj.ZoomBilin())->ReTagThis("ZoomBilin"));
aRes->AddFils(::ToXMLTree(std::string("SpeedZoomGrab"),anObj.SpeedZoomGrab())->ReTagThis("SpeedZoomGrab"));
aRes->AddFils(::ToXMLTree(std::string("SpeedZoomMolette"),anObj.SpeedZoomMolette())->ReTagThis("SpeedZoomMolette"));
aRes->AddFils(::ToXMLTree(std::string("ForceGray"),anObj.ForceGray())->ReTagThis("ForceGray"));
aRes->AddFils(::ToXMLTree(std::string("NumCrop"),anObj.NumCrop())->ReTagThis("NumCrop"));
for
( std::list< cXml_StatVino >::const_iterator it=anObj.Stats().begin();
it !=anObj.Stats().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("Stats"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXml_EnvVino & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.SzW(),aTree->Get("SzW",1)); //tototo
xml_init(anObj.SzLimSsEch(),aTree->Get("SzLimSsEch",1),double(2e7)); //tototo
xml_init(anObj.LargAsc(),aTree->Get("LargAsc",1)); //tototo
xml_init(anObj.SzIncr(),aTree->Get("SzIncr",1)); //tototo
xml_init(anObj.ZoomBilin(),aTree->Get("ZoomBilin",1)); //tototo
xml_init(anObj.SpeedZoomGrab(),aTree->Get("SpeedZoomGrab",1)); //tototo
xml_init(anObj.SpeedZoomMolette(),aTree->Get("SpeedZoomMolette",1)); //tototo
xml_init(anObj.ForceGray(),aTree->Get("ForceGray",1)); //tototo
xml_init(anObj.NumCrop(),aTree->Get("NumCrop",1)); //tototo
xml_init(anObj.Stats(),aTree->GetAll("Stats",false,1));
}
std::string Mangling( cXml_EnvVino *) {return "C652002BDA6E4D85FD3F";};
Box2dr & cXml_ParamBoxReducTieP::Box()
{
return mBox;
}
const Box2dr & cXml_ParamBoxReducTieP::Box()const
{
return mBox;
}
Box2dr & cXml_ParamBoxReducTieP::BoxRab()
{
return mBoxRab;
}
const Box2dr & cXml_ParamBoxReducTieP::BoxRab()const
{
return mBoxRab;
}
std::vector< std::string > & cXml_ParamBoxReducTieP::Ims()
{
return mIms;
}
const std::vector< std::string > & cXml_ParamBoxReducTieP::Ims()const
{
return mIms;
}
cTplValGesInit< std::string > & cXml_ParamBoxReducTieP::MasterIm()
{
return mMasterIm;
}
const cTplValGesInit< std::string > & cXml_ParamBoxReducTieP::MasterIm()const
{
return mMasterIm;
}
void BinaryUnDumpFromFile(cXml_ParamBoxReducTieP & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Box(),aFp);
BinaryUnDumpFromFile(anObj.BoxRab(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Ims().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.MasterIm().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.MasterIm().ValForcedForUnUmp(),aFp);
}
else anObj.MasterIm().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXml_ParamBoxReducTieP & anObj)
{
BinaryDumpInFile(aFp,anObj.Box());
BinaryDumpInFile(aFp,anObj.BoxRab());
BinaryDumpInFile(aFp,(int)anObj.Ims().size());
for( std::vector< std::string >::const_iterator iT=anObj.Ims().begin();
iT!=anObj.Ims().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.MasterIm().IsInit());
if (anObj.MasterIm().IsInit()) BinaryDumpInFile(aFp,anObj.MasterIm().Val());
}
cElXMLTree * ToXMLTree(const cXml_ParamBoxReducTieP & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"Xml_ParamBoxReducTieP",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Box"),anObj.Box())->ReTagThis("Box"));
aRes->AddFils(::ToXMLTree(std::string("BoxRab"),anObj.BoxRab())->ReTagThis("BoxRab"));
for
( std::vector< std::string >::const_iterator it=anObj.Ims().begin();
it !=anObj.Ims().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Ims"),(*it))->ReTagThis("Ims"));
if (anObj.MasterIm().IsInit())
aRes->AddFils(::ToXMLTree(std::string("MasterIm"),anObj.MasterIm().Val())->ReTagThis("MasterIm"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXml_ParamBoxReducTieP & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Box(),aTree->Get("Box",1)); //tototo
xml_init(anObj.BoxRab(),aTree->Get("BoxRab",1)); //tototo
xml_init(anObj.Ims(),aTree->GetAll("Ims",false,1));
xml_init(anObj.MasterIm(),aTree->Get("MasterIm",1)); //tototo
}
std::string Mangling( cXml_ParamBoxReducTieP *) {return "28A391B7E44E3CB0FF3F";};
Box2dr & cXml_ResOneImReducTieP::BoxIm()
{
return mBoxIm;
}
const Box2dr & cXml_ResOneImReducTieP::BoxIm()const
{
return mBoxIm;
}
double & cXml_ResOneImReducTieP::Resol()
{
return mResol;
}
const double & cXml_ResOneImReducTieP::Resol()const
{
return mResol;
}
void BinaryUnDumpFromFile(cXml_ResOneImReducTieP & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.BoxIm(),aFp);
BinaryUnDumpFromFile(anObj.Resol(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXml_ResOneImReducTieP & anObj)
{
BinaryDumpInFile(aFp,anObj.BoxIm());
BinaryDumpInFile(aFp,anObj.Resol());
}
cElXMLTree * ToXMLTree(const cXml_ResOneImReducTieP & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"Xml_ResOneImReducTieP",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("BoxIm"),anObj.BoxIm())->ReTagThis("BoxIm"));
aRes->AddFils(::ToXMLTree(std::string("Resol"),anObj.Resol())->ReTagThis("Resol"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXml_ResOneImReducTieP & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.BoxIm(),aTree->Get("BoxIm",1)); //tototo
xml_init(anObj.Resol(),aTree->Get("Resol",1)); //tototo
}
std::string Mangling( cXml_ResOneImReducTieP *) {return "20204B2249EDFDB0FCBF";};
double & cXml_ParamGlobReducTieP::Resol()
{
return mResol;
}
const double & cXml_ParamGlobReducTieP::Resol()const
{
return mResol;
}
void BinaryUnDumpFromFile(cXml_ParamGlobReducTieP & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Resol(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXml_ParamGlobReducTieP & anObj)
{
BinaryDumpInFile(aFp,anObj.Resol());
}
cElXMLTree * ToXMLTree(const cXml_ParamGlobReducTieP & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"Xml_ParamGlobReducTieP",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Resol"),anObj.Resol())->ReTagThis("Resol"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXml_ParamGlobReducTieP & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Resol(),aTree->Get("Resol",1)); //tototo
}
std::string Mangling( cXml_ParamGlobReducTieP *) {return "36D0C656A4B67986FD3F";};
int & cXml_ParamSubcommandTiepRed::NumInit()
{
return mNumInit;
}
const int & cXml_ParamSubcommandTiepRed::NumInit()const
{
return mNumInit;
}
int & cXml_ParamSubcommandTiepRed::NumSubcommands()
{
return mNumSubcommands;
}
const int & cXml_ParamSubcommandTiepRed::NumSubcommands()const
{
return mNumSubcommands;
}
int & cXml_ParamSubcommandTiepRed::MaxNumRelated()
{
return mMaxNumRelated;
}
const int & cXml_ParamSubcommandTiepRed::MaxNumRelated()const
{
return mMaxNumRelated;
}
std::vector< std::string > & cXml_ParamSubcommandTiepRed::Images()
{
return mImages;
}
const std::vector< std::string > & cXml_ParamSubcommandTiepRed::Images()const
{
return mImages;
}
void BinaryUnDumpFromFile(cXml_ParamSubcommandTiepRed & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.NumInit(),aFp);
BinaryUnDumpFromFile(anObj.NumSubcommands(),aFp);
BinaryUnDumpFromFile(anObj.MaxNumRelated(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Images().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXml_ParamSubcommandTiepRed & anObj)
{
BinaryDumpInFile(aFp,anObj.NumInit());
BinaryDumpInFile(aFp,anObj.NumSubcommands());
BinaryDumpInFile(aFp,anObj.MaxNumRelated());
BinaryDumpInFile(aFp,(int)anObj.Images().size());
for( std::vector< std::string >::const_iterator iT=anObj.Images().begin();
iT!=anObj.Images().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cXml_ParamSubcommandTiepRed & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"Xml_ParamSubcommandTiepRed",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("NumInit"),anObj.NumInit())->ReTagThis("NumInit"));
aRes->AddFils(::ToXMLTree(std::string("NumSubcommands"),anObj.NumSubcommands())->ReTagThis("NumSubcommands"));
aRes->AddFils(::ToXMLTree(std::string("MaxNumRelated"),anObj.MaxNumRelated())->ReTagThis("MaxNumRelated"));
for
( std::vector< std::string >::const_iterator it=anObj.Images().begin();
it !=anObj.Images().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("Images"),(*it))->ReTagThis("Images"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXml_ParamSubcommandTiepRed & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NumInit(),aTree->Get("NumInit",1)); //tototo
xml_init(anObj.NumSubcommands(),aTree->Get("NumSubcommands",1)); //tototo
xml_init(anObj.MaxNumRelated(),aTree->Get("MaxNumRelated",1)); //tototo
xml_init(anObj.Images(),aTree->GetAll("Images",false,1));
}
std::string Mangling( cXml_ParamSubcommandTiepRed *) {return "50C1F7D236C8A7F1FA3F";};
cTypeCodageMatr & cXml_ParamBascRigide::ParamRotation()
{
return mParamRotation;
}
const cTypeCodageMatr & cXml_ParamBascRigide::ParamRotation()const
{
return mParamRotation;
}
Pt3dr & cXml_ParamBascRigide::Trans()
{
return mTrans;
}
const Pt3dr & cXml_ParamBascRigide::Trans()const
{
return mTrans;
}
double & cXml_ParamBascRigide::Scale()
{
return mScale;
}
const double & cXml_ParamBascRigide::Scale()const
{
return mScale;
}
void BinaryUnDumpFromFile(cXml_ParamBascRigide & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.ParamRotation(),aFp);
BinaryUnDumpFromFile(anObj.Trans(),aFp);
BinaryUnDumpFromFile(anObj.Scale(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXml_ParamBascRigide & anObj)
{
BinaryDumpInFile(aFp,anObj.ParamRotation());
BinaryDumpInFile(aFp,anObj.Trans());
BinaryDumpInFile(aFp,anObj.Scale());
}
cElXMLTree * ToXMLTree(const cXml_ParamBascRigide & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"Xml_ParamBascRigide",eXMLBranche);
aRes->AddFils(ToXMLTree(anObj.ParamRotation())->ReTagThis("ParamRotation"));
aRes->AddFils(ToXMLTree(std::string("Trans"),anObj.Trans())->ReTagThis("Trans"));
aRes->AddFils(::ToXMLTree(std::string("Scale"),anObj.Scale())->ReTagThis("Scale"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXml_ParamBascRigide & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.ParamRotation(),aTree->Get("ParamRotation",1)); //tototo
xml_init(anObj.Trans(),aTree->Get("Trans",1)); //tototo
xml_init(anObj.Scale(),aTree->Get("Scale",1)); //tototo
}
std::string Mangling( cXml_ParamBascRigide *) {return "208BF9FC385D0787FD3F";};
std::string & cXml_ResiduBascule::Name()
{
return mName;
}
const std::string & cXml_ResiduBascule::Name()const
{
return mName;
}
Pt3dr & cXml_ResiduBascule::Offset()
{
return mOffset;
}
const Pt3dr & cXml_ResiduBascule::Offset()const
{
return mOffset;
}
double & cXml_ResiduBascule::Dist()
{
return mDist;
}
const double & cXml_ResiduBascule::Dist()const
{
return mDist;
}
void BinaryUnDumpFromFile(cXml_ResiduBascule & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Name(),aFp);
BinaryUnDumpFromFile(anObj.Offset(),aFp);
BinaryUnDumpFromFile(anObj.Dist(),aFp);
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXml_ResiduBascule & anObj)
{
BinaryDumpInFile(aFp,anObj.Name());
BinaryDumpInFile(aFp,anObj.Offset());
BinaryDumpInFile(aFp,anObj.Dist());
}
cElXMLTree * ToXMLTree(const cXml_ResiduBascule & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"Xml_ResiduBascule",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Name"),anObj.Name())->ReTagThis("Name"));
aRes->AddFils(ToXMLTree(std::string("Offset"),anObj.Offset())->ReTagThis("Offset"));
aRes->AddFils(::ToXMLTree(std::string("Dist"),anObj.Dist())->ReTagThis("Dist"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXml_ResiduBascule & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Name(),aTree->Get("Name",1)); //tototo
xml_init(anObj.Offset(),aTree->Get("Offset",1)); //tototo
xml_init(anObj.Dist(),aTree->Get("Dist",1)); //tototo
}
std::string Mangling( cXml_ResiduBascule *) {return "F226D3EB3BBB689CFF3F";};
cXml_ParamBascRigide & cXml_SolBascRigide::Param()
{
return mParam;
}
const cXml_ParamBascRigide & cXml_SolBascRigide::Param()const
{
return mParam;
}
double & cXml_SolBascRigide::MoyenneDist()
{
return mMoyenneDist;
}
const double & cXml_SolBascRigide::MoyenneDist()const
{
return mMoyenneDist;
}
double & cXml_SolBascRigide::MoyenneDistAlti()
{
return mMoyenneDistAlti;
}
const double & cXml_SolBascRigide::MoyenneDistAlti()const
{
return mMoyenneDistAlti;
}
double & cXml_SolBascRigide::MoyenneDistPlani()
{
return mMoyenneDistPlani;
}
const double & cXml_SolBascRigide::MoyenneDistPlani()const
{
return mMoyenneDistPlani;
}
cXml_ResiduBascule & cXml_SolBascRigide::Worst()
{
return mWorst;
}
const cXml_ResiduBascule & cXml_SolBascRigide::Worst()const
{
return mWorst;
}
std::list< cXml_ResiduBascule > & cXml_SolBascRigide::Residus()
{
return mResidus;
}
const std::list< cXml_ResiduBascule > & cXml_SolBascRigide::Residus()const
{
return mResidus;
}
void BinaryUnDumpFromFile(cXml_SolBascRigide & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Param(),aFp);
BinaryUnDumpFromFile(anObj.MoyenneDist(),aFp);
BinaryUnDumpFromFile(anObj.MoyenneDistAlti(),aFp);
BinaryUnDumpFromFile(anObj.MoyenneDistPlani(),aFp);
BinaryUnDumpFromFile(anObj.Worst(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cXml_ResiduBascule aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.Residus().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXml_SolBascRigide & anObj)
{
BinaryDumpInFile(aFp,anObj.Param());
BinaryDumpInFile(aFp,anObj.MoyenneDist());
BinaryDumpInFile(aFp,anObj.MoyenneDistAlti());
BinaryDumpInFile(aFp,anObj.MoyenneDistPlani());
BinaryDumpInFile(aFp,anObj.Worst());
BinaryDumpInFile(aFp,(int)anObj.Residus().size());
for( std::list< cXml_ResiduBascule >::const_iterator iT=anObj.Residus().begin();
iT!=anObj.Residus().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cXml_SolBascRigide & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"Xml_SolBascRigide",eXMLBranche);
aRes->AddFils(ToXMLTree(anObj.Param())->ReTagThis("Param"));
aRes->AddFils(::ToXMLTree(std::string("MoyenneDist"),anObj.MoyenneDist())->ReTagThis("MoyenneDist"));
aRes->AddFils(::ToXMLTree(std::string("MoyenneDistAlti"),anObj.MoyenneDistAlti())->ReTagThis("MoyenneDistAlti"));
aRes->AddFils(::ToXMLTree(std::string("MoyenneDistPlani"),anObj.MoyenneDistPlani())->ReTagThis("MoyenneDistPlani"));
aRes->AddFils(ToXMLTree(anObj.Worst())->ReTagThis("Worst"));
for
( std::list< cXml_ResiduBascule >::const_iterator it=anObj.Residus().begin();
it !=anObj.Residus().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("Residus"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXml_SolBascRigide & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Param(),aTree->Get("Param",1)); //tototo
xml_init(anObj.MoyenneDist(),aTree->Get("MoyenneDist",1)); //tototo
xml_init(anObj.MoyenneDistAlti(),aTree->Get("MoyenneDistAlti",1)); //tototo
xml_init(anObj.MoyenneDistPlani(),aTree->Get("MoyenneDistPlani",1)); //tototo
xml_init(anObj.Worst(),aTree->Get("Worst",1)); //tototo
xml_init(anObj.Residus(),aTree->GetAll("Residus",false,1));
}
std::string Mangling( cXml_SolBascRigide *) {return "6C261C07B3A65EC6FA3F";};
eCmdMM_Feature Str2eCmdMM_Feature(const std::string & aName)
{
if (aName=="eCmf_Control")
return eCmf_Control;
else if (aName=="eCmf_Convert")
return eCmf_Convert;
else if (aName=="eCmf_ImProc")
return eCmf_ImProc;
else if (aName=="eCmf_Interf")
return eCmf_Interf;
else if (aName=="eCmf_Orient")
return eCmf_Orient;
else if (aName=="eCmf_OriAbs")
return eCmf_OriAbs;
else if (aName=="eCmf_OriSat")
return eCmf_OriSat;
else if (aName=="eCmf_TiePoints")
return eCmf_TiePoints;
else if (aName=="eCmf_ImMatch")
return eCmf_ImMatch;
else if (aName=="eCmf_Map2D")
return eCmf_Map2D;
else if (aName=="eCmf_TrajGnss")
return eCmf_TrajGnss;
else if (aName=="eCmf_NbVals")
return eCmf_NbVals;
else
{
cout << aName << " is not a correct value for enum eCmdMM_Feature\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eCmdMM_Feature) 0;
}
void xml_init(eCmdMM_Feature & aVal,cElXMLTree * aTree)
{
aVal= Str2eCmdMM_Feature(aTree->Contenu());
}
std::string eToString(const eCmdMM_Feature & anObj)
{
if (anObj==eCmf_Control)
return "eCmf_Control";
if (anObj==eCmf_Convert)
return "eCmf_Convert";
if (anObj==eCmf_ImProc)
return "eCmf_ImProc";
if (anObj==eCmf_Interf)
return "eCmf_Interf";
if (anObj==eCmf_Orient)
return "eCmf_Orient";
if (anObj==eCmf_OriAbs)
return "eCmf_OriAbs";
if (anObj==eCmf_OriSat)
return "eCmf_OriSat";
if (anObj==eCmf_TiePoints)
return "eCmf_TiePoints";
if (anObj==eCmf_ImMatch)
return "eCmf_ImMatch";
if (anObj==eCmf_Map2D)
return "eCmf_Map2D";
if (anObj==eCmf_TrajGnss)
return "eCmf_TrajGnss";
if (anObj==eCmf_NbVals)
return "eCmf_NbVals";
std::cout << "Enum = eCmdMM_Feature\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eCmdMM_Feature & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eCmdMM_Feature & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eCmdMM_Feature & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eCmdMM_Feature) aIVal;
}
std::string Mangling( eCmdMM_Feature *) {return "29DE526E46DD9CF9FD3F";};
eCmdMM_DataType Str2eCmdMM_DataType(const std::string & aName)
{
if (aName=="eCmDt_Orient")
return eCmDt_Orient;
else if (aName=="eCmDt_Images")
return eCmDt_Images;
else if (aName=="eCmDt_TiePoints")
return eCmDt_TiePoints;
else if (aName=="eCmDt_CloudXML")
return eCmDt_CloudXML;
else if (aName=="eCmDt_FileXML")
return eCmDt_FileXML;
else if (aName=="eCmDt_FileTxt")
return eCmDt_FileTxt;
else if (aName=="eCmDt_GCP")
return eCmDt_GCP;
else if (aName=="eCmDt_PtImMes")
return eCmDt_PtImMes;
else if (aName=="eCmDt_Any")
return eCmDt_Any;
else if (aName=="eCmDt_None")
return eCmDt_None;
else if (aName=="eCmDt_Ply")
return eCmDt_Ply;
else if (aName=="eCmDt_Map2D")
return eCmDt_Map2D;
else if (aName=="eCmDt_NbVals")
return eCmDt_NbVals;
else
{
cout << aName << " is not a correct value for enum eCmdMM_DataType\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eCmdMM_DataType) 0;
}
void xml_init(eCmdMM_DataType & aVal,cElXMLTree * aTree)
{
aVal= Str2eCmdMM_DataType(aTree->Contenu());
}
std::string eToString(const eCmdMM_DataType & anObj)
{
if (anObj==eCmDt_Orient)
return "eCmDt_Orient";
if (anObj==eCmDt_Images)
return "eCmDt_Images";
if (anObj==eCmDt_TiePoints)
return "eCmDt_TiePoints";
if (anObj==eCmDt_CloudXML)
return "eCmDt_CloudXML";
if (anObj==eCmDt_FileXML)
return "eCmDt_FileXML";
if (anObj==eCmDt_FileTxt)
return "eCmDt_FileTxt";
if (anObj==eCmDt_GCP)
return "eCmDt_GCP";
if (anObj==eCmDt_PtImMes)
return "eCmDt_PtImMes";
if (anObj==eCmDt_Any)
return "eCmDt_Any";
if (anObj==eCmDt_None)
return "eCmDt_None";
if (anObj==eCmDt_Ply)
return "eCmDt_Ply";
if (anObj==eCmDt_Map2D)
return "eCmDt_Map2D";
if (anObj==eCmDt_NbVals)
return "eCmDt_NbVals";
std::cout << "Enum = eCmdMM_DataType\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eCmdMM_DataType & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eCmdMM_DataType & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eCmdMM_DataType & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eCmdMM_DataType) aIVal;
}
std::string Mangling( eCmdMM_DataType *) {return "CED194FEA534A5D9FD3F";};
eCmdMM_Group Str2eCmdMM_Group(const std::string & aName)
{
if (aName=="eCmGrp_mm3d")
return eCmGrp_mm3d;
else if (aName=="eCmGrp_TestLib")
return eCmGrp_TestLib;
else if (aName=="eCmGrp_SateLib")
return eCmGrp_SateLib;
else if (aName=="eCmGrp_SimuLib")
return eCmGrp_SimuLib;
else if (aName=="eCmGrp_XLib")
return eCmGrp_XLib;
else if (aName=="eCmGrp_NbVals")
return eCmGrp_NbVals;
else
{
cout << aName << " is not a correct value for enum eCmdMM_Group\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eCmdMM_Group) 0;
}
void xml_init(eCmdMM_Group & aVal,cElXMLTree * aTree)
{
aVal= Str2eCmdMM_Group(aTree->Contenu());
}
std::string eToString(const eCmdMM_Group & anObj)
{
if (anObj==eCmGrp_mm3d)
return "eCmGrp_mm3d";
if (anObj==eCmGrp_TestLib)
return "eCmGrp_TestLib";
if (anObj==eCmGrp_SateLib)
return "eCmGrp_SateLib";
if (anObj==eCmGrp_SimuLib)
return "eCmGrp_SimuLib";
if (anObj==eCmGrp_XLib)
return "eCmGrp_XLib";
if (anObj==eCmGrp_NbVals)
return "eCmGrp_NbVals";
std::cout << "Enum = eCmdMM_Group\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eCmdMM_Group & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eCmdMM_Group & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eCmdMM_Group & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eCmdMM_Group) aIVal;
}
std::string Mangling( eCmdMM_Group *) {return "D8FC2F2E594DA8AFFF3F";};
std::string & cXml_Specif1MMCmd::Name()
{
return mName;
}
const std::string & cXml_Specif1MMCmd::Name()const
{
return mName;
}
eCmdMM_Feature & cXml_Specif1MMCmd::MainFeature()
{
return mMainFeature;
}
const eCmdMM_Feature & cXml_Specif1MMCmd::MainFeature()const
{
return mMainFeature;
}
eCmdMM_DataType & cXml_Specif1MMCmd::MainInput()
{
return mMainInput;
}
const eCmdMM_DataType & cXml_Specif1MMCmd::MainInput()const
{
return mMainInput;
}
eCmdMM_DataType & cXml_Specif1MMCmd::MainOutput()
{
return mMainOutput;
}
const eCmdMM_DataType & cXml_Specif1MMCmd::MainOutput()const
{
return mMainOutput;
}
cTplValGesInit< eCmdMM_Group > & cXml_Specif1MMCmd::Group()
{
return mGroup;
}
const cTplValGesInit< eCmdMM_Group > & cXml_Specif1MMCmd::Group()const
{
return mGroup;
}
cTplValGesInit< std::string > & cXml_Specif1MMCmd::Option()
{
return mOption;
}
const cTplValGesInit< std::string > & cXml_Specif1MMCmd::Option()const
{
return mOption;
}
std::list< eCmdMM_Feature > & cXml_Specif1MMCmd::OtherFeature()
{
return mOtherFeature;
}
const std::list< eCmdMM_Feature > & cXml_Specif1MMCmd::OtherFeature()const
{
return mOtherFeature;
}
std::list< eCmdMM_DataType > & cXml_Specif1MMCmd::OtherInput()
{
return mOtherInput;
}
const std::list< eCmdMM_DataType > & cXml_Specif1MMCmd::OtherInput()const
{
return mOtherInput;
}
std::list< eCmdMM_DataType > & cXml_Specif1MMCmd::OtherOutput()
{
return mOtherOutput;
}
const std::list< eCmdMM_DataType > & cXml_Specif1MMCmd::OtherOutput()const
{
return mOtherOutput;
}
cTplValGesInit< Pt3di > & cXml_Specif1MMCmd::CreationDate()
{
return mCreationDate;
}
const cTplValGesInit< Pt3di > & cXml_Specif1MMCmd::CreationDate()const
{
return mCreationDate;
}
cTplValGesInit< Pt3di > & cXml_Specif1MMCmd::ModifDate()
{
return mModifDate;
}
const cTplValGesInit< Pt3di > & cXml_Specif1MMCmd::ModifDate()const
{
return mModifDate;
}
std::list< std::string > & cXml_Specif1MMCmd::DependOf()
{
return mDependOf;
}
const std::list< std::string > & cXml_Specif1MMCmd::DependOf()const
{
return mDependOf;
}
std::list< std::string > & cXml_Specif1MMCmd::UsedBy()
{
return mUsedBy;
}
const std::list< std::string > & cXml_Specif1MMCmd::UsedBy()const
{
return mUsedBy;
}
void BinaryUnDumpFromFile(cXml_Specif1MMCmd & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.Name(),aFp);
BinaryUnDumpFromFile(anObj.MainFeature(),aFp);
BinaryUnDumpFromFile(anObj.MainInput(),aFp);
BinaryUnDumpFromFile(anObj.MainOutput(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Group().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Group().ValForcedForUnUmp(),aFp);
}
else anObj.Group().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Option().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Option().ValForcedForUnUmp(),aFp);
}
else anObj.Option().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
eCmdMM_Feature aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.OtherFeature().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
eCmdMM_DataType aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.OtherInput().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
eCmdMM_DataType aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.OtherOutput().push_back(aVal);
}
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.CreationDate().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.CreationDate().ValForcedForUnUmp(),aFp);
}
else anObj.CreationDate().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.ModifDate().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.ModifDate().ValForcedForUnUmp(),aFp);
}
else anObj.ModifDate().SetNoInit();
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.DependOf().push_back(aVal);
}
} ;
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.UsedBy().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXml_Specif1MMCmd & anObj)
{
BinaryDumpInFile(aFp,anObj.Name());
BinaryDumpInFile(aFp,anObj.MainFeature());
BinaryDumpInFile(aFp,anObj.MainInput());
BinaryDumpInFile(aFp,anObj.MainOutput());
BinaryDumpInFile(aFp,anObj.Group().IsInit());
if (anObj.Group().IsInit()) BinaryDumpInFile(aFp,anObj.Group().Val());
BinaryDumpInFile(aFp,anObj.Option().IsInit());
if (anObj.Option().IsInit()) BinaryDumpInFile(aFp,anObj.Option().Val());
BinaryDumpInFile(aFp,(int)anObj.OtherFeature().size());
for( std::list< eCmdMM_Feature >::const_iterator iT=anObj.OtherFeature().begin();
iT!=anObj.OtherFeature().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.OtherInput().size());
for( std::list< eCmdMM_DataType >::const_iterator iT=anObj.OtherInput().begin();
iT!=anObj.OtherInput().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.OtherOutput().size());
for( std::list< eCmdMM_DataType >::const_iterator iT=anObj.OtherOutput().begin();
iT!=anObj.OtherOutput().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,anObj.CreationDate().IsInit());
if (anObj.CreationDate().IsInit()) BinaryDumpInFile(aFp,anObj.CreationDate().Val());
BinaryDumpInFile(aFp,anObj.ModifDate().IsInit());
if (anObj.ModifDate().IsInit()) BinaryDumpInFile(aFp,anObj.ModifDate().Val());
BinaryDumpInFile(aFp,(int)anObj.DependOf().size());
for( std::list< std::string >::const_iterator iT=anObj.DependOf().begin();
iT!=anObj.DependOf().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
BinaryDumpInFile(aFp,(int)anObj.UsedBy().size());
for( std::list< std::string >::const_iterator iT=anObj.UsedBy().begin();
iT!=anObj.UsedBy().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cXml_Specif1MMCmd & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"Xml_Specif1MMCmd",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("Name"),anObj.Name())->ReTagThis("Name"));
aRes->AddFils(ToXMLTree(std::string("MainFeature"),anObj.MainFeature())->ReTagThis("MainFeature"));
aRes->AddFils(ToXMLTree(std::string("MainInput"),anObj.MainInput())->ReTagThis("MainInput"));
aRes->AddFils(ToXMLTree(std::string("MainOutput"),anObj.MainOutput())->ReTagThis("MainOutput"));
if (anObj.Group().IsInit())
aRes->AddFils(ToXMLTree(std::string("Group"),anObj.Group().Val())->ReTagThis("Group"));
if (anObj.Option().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Option"),anObj.Option().Val())->ReTagThis("Option"));
for
( std::list< eCmdMM_Feature >::const_iterator it=anObj.OtherFeature().begin();
it !=anObj.OtherFeature().end();
it++
)
aRes->AddFils(ToXMLTree(std::string("OtherFeature"),(*it))->ReTagThis("OtherFeature"));
for
( std::list< eCmdMM_DataType >::const_iterator it=anObj.OtherInput().begin();
it !=anObj.OtherInput().end();
it++
)
aRes->AddFils(ToXMLTree(std::string("OtherInput"),(*it))->ReTagThis("OtherInput"));
for
( std::list< eCmdMM_DataType >::const_iterator it=anObj.OtherOutput().begin();
it !=anObj.OtherOutput().end();
it++
)
aRes->AddFils(ToXMLTree(std::string("OtherOutput"),(*it))->ReTagThis("OtherOutput"));
if (anObj.CreationDate().IsInit())
aRes->AddFils(::ToXMLTree(std::string("CreationDate"),anObj.CreationDate().Val())->ReTagThis("CreationDate"));
if (anObj.ModifDate().IsInit())
aRes->AddFils(::ToXMLTree(std::string("ModifDate"),anObj.ModifDate().Val())->ReTagThis("ModifDate"));
for
( std::list< std::string >::const_iterator it=anObj.DependOf().begin();
it !=anObj.DependOf().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("DependOf"),(*it))->ReTagThis("DependOf"));
for
( std::list< std::string >::const_iterator it=anObj.UsedBy().begin();
it !=anObj.UsedBy().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("UsedBy"),(*it))->ReTagThis("UsedBy"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXml_Specif1MMCmd & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Name(),aTree->Get("Name",1)); //tototo
xml_init(anObj.MainFeature(),aTree->Get("MainFeature",1)); //tototo
xml_init(anObj.MainInput(),aTree->Get("MainInput",1)); //tototo
xml_init(anObj.MainOutput(),aTree->Get("MainOutput",1)); //tototo
xml_init(anObj.Group(),aTree->Get("Group",1)); //tototo
xml_init(anObj.Option(),aTree->Get("Option",1)); //tototo
xml_init(anObj.OtherFeature(),aTree->GetAll("OtherFeature",false,1));
xml_init(anObj.OtherInput(),aTree->GetAll("OtherInput",false,1));
xml_init(anObj.OtherOutput(),aTree->GetAll("OtherOutput",false,1));
xml_init(anObj.CreationDate(),aTree->Get("CreationDate",1),Pt3di(Pt3di(21,9,2008))); //tototo
xml_init(anObj.ModifDate(),aTree->Get("ModifDate",1),Pt3di(Pt3di(21,9,2008))); //tototo
xml_init(anObj.DependOf(),aTree->GetAll("DependOf",false,1));
xml_init(anObj.UsedBy(),aTree->GetAll("UsedBy",false,1));
}
std::string Mangling( cXml_Specif1MMCmd *) {return "EB9D5EC5593ED8A1FF3F";};
std::list< cXml_Specif1MMCmd > & cXml_SpecifAllMMCmd::OneCmd()
{
return mOneCmd;
}
const std::list< cXml_Specif1MMCmd > & cXml_SpecifAllMMCmd::OneCmd()const
{
return mOneCmd;
}
void BinaryUnDumpFromFile(cXml_SpecifAllMMCmd & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cXml_Specif1MMCmd aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.OneCmd().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXml_SpecifAllMMCmd & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.OneCmd().size());
for( std::list< cXml_Specif1MMCmd >::const_iterator iT=anObj.OneCmd().begin();
iT!=anObj.OneCmd().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cXml_SpecifAllMMCmd & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"Xml_SpecifAllMMCmd",eXMLBranche);
for
( std::list< cXml_Specif1MMCmd >::const_iterator it=anObj.OneCmd().begin();
it !=anObj.OneCmd().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("OneCmd"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXml_SpecifAllMMCmd & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.OneCmd(),aTree->GetAll("OneCmd",false,1));
}
std::string Mangling( cXml_SpecifAllMMCmd *) {return "20390C65F56AF2DEFB3F";};
cTplValGesInit< int > & cGS_OneLinear::Period()
{
return mPeriod;
}
const cTplValGesInit< int > & cGS_OneLinear::Period()const
{
return mPeriod;
}
int & cGS_OneLinear::DeltaMin()
{
return mDeltaMin;
}
const int & cGS_OneLinear::DeltaMin()const
{
return mDeltaMin;
}
int & cGS_OneLinear::DeltaMax()
{
return mDeltaMax;
}
const int & cGS_OneLinear::DeltaMax()const
{
return mDeltaMax;
}
std::list< cCpleString > & cGS_OneLinear::CpleGrp()
{
return mCpleGrp;
}
const std::list< cCpleString > & cGS_OneLinear::CpleGrp()const
{
return mCpleGrp;
}
void BinaryUnDumpFromFile(cGS_OneLinear & anObj,ELISE_fp & aFp)
{
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.Period().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.Period().ValForcedForUnUmp(),aFp);
}
else anObj.Period().SetNoInit();
} ;
BinaryUnDumpFromFile(anObj.DeltaMin(),aFp);
BinaryUnDumpFromFile(anObj.DeltaMax(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cCpleString aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.CpleGrp().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cGS_OneLinear & anObj)
{
BinaryDumpInFile(aFp,anObj.Period().IsInit());
if (anObj.Period().IsInit()) BinaryDumpInFile(aFp,anObj.Period().Val());
BinaryDumpInFile(aFp,anObj.DeltaMin());
BinaryDumpInFile(aFp,anObj.DeltaMax());
BinaryDumpInFile(aFp,(int)anObj.CpleGrp().size());
for( std::list< cCpleString >::const_iterator iT=anObj.CpleGrp().begin();
iT!=anObj.CpleGrp().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cGS_OneLinear & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"GS_OneLinear",eXMLBranche);
if (anObj.Period().IsInit())
aRes->AddFils(::ToXMLTree(std::string("Period"),anObj.Period().Val())->ReTagThis("Period"));
aRes->AddFils(::ToXMLTree(std::string("DeltaMin"),anObj.DeltaMin())->ReTagThis("DeltaMin"));
aRes->AddFils(::ToXMLTree(std::string("DeltaMax"),anObj.DeltaMax())->ReTagThis("DeltaMax"));
for
( std::list< cCpleString >::const_iterator it=anObj.CpleGrp().begin();
it !=anObj.CpleGrp().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("CpleGrp"),(*it))->ReTagThis("CpleGrp"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cGS_OneLinear & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.Period(),aTree->Get("Period",1),int(1)); //tototo
xml_init(anObj.DeltaMin(),aTree->Get("DeltaMin",1)); //tototo
xml_init(anObj.DeltaMax(),aTree->Get("DeltaMax",1)); //tototo
xml_init(anObj.CpleGrp(),aTree->GetAll("CpleGrp",false,1));
}
std::string Mangling( cGS_OneLinear *) {return "58A1E21FDC4D6BC8FDBF";};
std::list< cGS_OneLinear > & cGS_SectionLinear::GS_OneLinear()
{
return mGS_OneLinear;
}
const std::list< cGS_OneLinear > & cGS_SectionLinear::GS_OneLinear()const
{
return mGS_OneLinear;
}
void BinaryUnDumpFromFile(cGS_SectionLinear & anObj,ELISE_fp & aFp)
{
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cGS_OneLinear aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.GS_OneLinear().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cGS_SectionLinear & anObj)
{
BinaryDumpInFile(aFp,(int)anObj.GS_OneLinear().size());
for( std::list< cGS_OneLinear >::const_iterator iT=anObj.GS_OneLinear().begin();
iT!=anObj.GS_OneLinear().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cGS_SectionLinear & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"GS_SectionLinear",eXMLBranche);
for
( std::list< cGS_OneLinear >::const_iterator it=anObj.GS_OneLinear().begin();
it !=anObj.GS_OneLinear().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("GS_OneLinear"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cGS_SectionLinear & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.GS_OneLinear(),aTree->GetAll("GS_OneLinear",false,1));
}
std::string Mangling( cGS_SectionLinear *) {return "5AD3092E3A64FEC0FE3F";};
double & cGS_SectionCross::DistMax()
{
return mDistMax;
}
const double & cGS_SectionCross::DistMax()const
{
return mDistMax;
}
double & cGS_SectionCross::DistCurvMin()
{
return mDistCurvMin;
}
const double & cGS_SectionCross::DistCurvMin()const
{
return mDistCurvMin;
}
double & cGS_SectionCross::AngleMinSpeed()
{
return mAngleMinSpeed;
}
const double & cGS_SectionCross::AngleMinSpeed()const
{
return mAngleMinSpeed;
}
double & cGS_SectionCross::DistMinTraj()
{
return mDistMinTraj;
}
const double & cGS_SectionCross::DistMinTraj()const
{
return mDistMinTraj;
}
std::list< std::string > & cGS_SectionCross::ListCam()
{
return mListCam;
}
const std::list< std::string > & cGS_SectionCross::ListCam()const
{
return mListCam;
}
void BinaryUnDumpFromFile(cGS_SectionCross & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.DistMax(),aFp);
BinaryUnDumpFromFile(anObj.DistCurvMin(),aFp);
BinaryUnDumpFromFile(anObj.AngleMinSpeed(),aFp);
BinaryUnDumpFromFile(anObj.DistMinTraj(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
std::string aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.ListCam().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cGS_SectionCross & anObj)
{
BinaryDumpInFile(aFp,anObj.DistMax());
BinaryDumpInFile(aFp,anObj.DistCurvMin());
BinaryDumpInFile(aFp,anObj.AngleMinSpeed());
BinaryDumpInFile(aFp,anObj.DistMinTraj());
BinaryDumpInFile(aFp,(int)anObj.ListCam().size());
for( std::list< std::string >::const_iterator iT=anObj.ListCam().begin();
iT!=anObj.ListCam().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cGS_SectionCross & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"GS_SectionCross",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("DistMax"),anObj.DistMax())->ReTagThis("DistMax"));
aRes->AddFils(::ToXMLTree(std::string("DistCurvMin"),anObj.DistCurvMin())->ReTagThis("DistCurvMin"));
aRes->AddFils(::ToXMLTree(std::string("AngleMinSpeed"),anObj.AngleMinSpeed())->ReTagThis("AngleMinSpeed"));
aRes->AddFils(::ToXMLTree(std::string("DistMinTraj"),anObj.DistMinTraj())->ReTagThis("DistMinTraj"));
for
( std::list< std::string >::const_iterator it=anObj.ListCam().begin();
it !=anObj.ListCam().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("ListCam"),(*it))->ReTagThis("ListCam"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cGS_SectionCross & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.DistMax(),aTree->Get("DistMax",1)); //tototo
xml_init(anObj.DistCurvMin(),aTree->Get("DistCurvMin",1)); //tototo
xml_init(anObj.AngleMinSpeed(),aTree->Get("AngleMinSpeed",1)); //tototo
xml_init(anObj.DistMinTraj(),aTree->Get("DistMinTraj",1)); //tototo
xml_init(anObj.ListCam(),aTree->GetAll("ListCam",false,1));
}
std::string Mangling( cGS_SectionCross *) {return "1722A5927232D4EEFC3F";};
double & cOneInterv_OT::DistMax()
{
return mDistMax;
}
const double & cOneInterv_OT::DistMax()const
{
return mDistMax;
}
std::list< cCpleString > & cOneInterv_OT::CpleGrp()
{
return mCpleGrp;
}
const std::list< cCpleString > & cOneInterv_OT::CpleGrp()const
{
return mCpleGrp;
}
void BinaryUnDumpFromFile(cOneInterv_OT & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.DistMax(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cCpleString aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.CpleGrp().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cOneInterv_OT & anObj)
{
BinaryDumpInFile(aFp,anObj.DistMax());
BinaryDumpInFile(aFp,(int)anObj.CpleGrp().size());
for( std::list< cCpleString >::const_iterator iT=anObj.CpleGrp().begin();
iT!=anObj.CpleGrp().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cOneInterv_OT & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"OneInterv_OT",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("DistMax"),anObj.DistMax())->ReTagThis("DistMax"));
for
( std::list< cCpleString >::const_iterator it=anObj.CpleGrp().begin();
it !=anObj.CpleGrp().end();
it++
)
aRes->AddFils(::ToXMLTree(std::string("CpleGrp"),(*it))->ReTagThis("CpleGrp"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cOneInterv_OT & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.DistMax(),aTree->Get("DistMax",1)); //tototo
xml_init(anObj.CpleGrp(),aTree->GetAll("CpleGrp",false,1));
}
std::string Mangling( cOneInterv_OT *) {return "58C0CB36EE31F8ABFA3F";};
double & cGS_SectionOverlapingTraj::AngleMaxSpeed()
{
return mAngleMaxSpeed;
}
const double & cGS_SectionOverlapingTraj::AngleMaxSpeed()const
{
return mAngleMaxSpeed;
}
double & cGS_SectionOverlapingTraj::DistMaxTraj()
{
return mDistMaxTraj;
}
const double & cGS_SectionOverlapingTraj::DistMaxTraj()const
{
return mDistMaxTraj;
}
std::list< cOneInterv_OT > & cGS_SectionOverlapingTraj::OneInterv_OT()
{
return mOneInterv_OT;
}
const std::list< cOneInterv_OT > & cGS_SectionOverlapingTraj::OneInterv_OT()const
{
return mOneInterv_OT;
}
void BinaryUnDumpFromFile(cGS_SectionOverlapingTraj & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.AngleMaxSpeed(),aFp);
BinaryUnDumpFromFile(anObj.DistMaxTraj(),aFp);
{ int aNb;
BinaryUnDumpFromFile(aNb,aFp);
for( int aK=0 ; aK<aNb ; aK++)
{
cOneInterv_OT aVal;
BinaryUnDumpFromFile(aVal,aFp);
anObj.OneInterv_OT().push_back(aVal);
}
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cGS_SectionOverlapingTraj & anObj)
{
BinaryDumpInFile(aFp,anObj.AngleMaxSpeed());
BinaryDumpInFile(aFp,anObj.DistMaxTraj());
BinaryDumpInFile(aFp,(int)anObj.OneInterv_OT().size());
for( std::list< cOneInterv_OT >::const_iterator iT=anObj.OneInterv_OT().begin();
iT!=anObj.OneInterv_OT().end();
iT++
)
BinaryDumpInFile(aFp,*iT);
}
cElXMLTree * ToXMLTree(const cGS_SectionOverlapingTraj & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"GS_SectionOverlapingTraj",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("AngleMaxSpeed"),anObj.AngleMaxSpeed())->ReTagThis("AngleMaxSpeed"));
aRes->AddFils(::ToXMLTree(std::string("DistMaxTraj"),anObj.DistMaxTraj())->ReTagThis("DistMaxTraj"));
for
( std::list< cOneInterv_OT >::const_iterator it=anObj.OneInterv_OT().begin();
it !=anObj.OneInterv_OT().end();
it++
)
aRes->AddFils(ToXMLTree((*it))->ReTagThis("OneInterv_OT"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cGS_SectionOverlapingTraj & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.AngleMaxSpeed(),aTree->Get("AngleMaxSpeed",1)); //tototo
xml_init(anObj.DistMaxTraj(),aTree->Get("DistMaxTraj",1)); //tototo
xml_init(anObj.OneInterv_OT(),aTree->GetAll("OneInterv_OT",false,1));
}
std::string Mangling( cGS_SectionOverlapingTraj *) {return "DB47F3DDFF7A7AEDFD3F";};
std::string & cXml_ParamGraphStereopolis::NameGrpC()
{
return mNameGrpC;
}
const std::string & cXml_ParamGraphStereopolis::NameGrpC()const
{
return mNameGrpC;
}
std::list< cGS_OneLinear > & cXml_ParamGraphStereopolis::GS_OneLinear()
{
return GS_SectionLinear().Val().GS_OneLinear();
}
const std::list< cGS_OneLinear > & cXml_ParamGraphStereopolis::GS_OneLinear()const
{
return GS_SectionLinear().Val().GS_OneLinear();
}
cTplValGesInit< cGS_SectionLinear > & cXml_ParamGraphStereopolis::GS_SectionLinear()
{
return mGS_SectionLinear;
}
const cTplValGesInit< cGS_SectionLinear > & cXml_ParamGraphStereopolis::GS_SectionLinear()const
{
return mGS_SectionLinear;
}
double & cXml_ParamGraphStereopolis::DistMax()
{
return GS_SectionCross().Val().DistMax();
}
const double & cXml_ParamGraphStereopolis::DistMax()const
{
return GS_SectionCross().Val().DistMax();
}
double & cXml_ParamGraphStereopolis::DistCurvMin()
{
return GS_SectionCross().Val().DistCurvMin();
}
const double & cXml_ParamGraphStereopolis::DistCurvMin()const
{
return GS_SectionCross().Val().DistCurvMin();
}
double & cXml_ParamGraphStereopolis::AngleMinSpeed()
{
return GS_SectionCross().Val().AngleMinSpeed();
}
const double & cXml_ParamGraphStereopolis::AngleMinSpeed()const
{
return GS_SectionCross().Val().AngleMinSpeed();
}
double & cXml_ParamGraphStereopolis::DistMinTraj()
{
return GS_SectionCross().Val().DistMinTraj();
}
const double & cXml_ParamGraphStereopolis::DistMinTraj()const
{
return GS_SectionCross().Val().DistMinTraj();
}
std::list< std::string > & cXml_ParamGraphStereopolis::ListCam()
{
return GS_SectionCross().Val().ListCam();
}
const std::list< std::string > & cXml_ParamGraphStereopolis::ListCam()const
{
return GS_SectionCross().Val().ListCam();
}
cTplValGesInit< cGS_SectionCross > & cXml_ParamGraphStereopolis::GS_SectionCross()
{
return mGS_SectionCross;
}
const cTplValGesInit< cGS_SectionCross > & cXml_ParamGraphStereopolis::GS_SectionCross()const
{
return mGS_SectionCross;
}
double & cXml_ParamGraphStereopolis::AngleMaxSpeed()
{
return GS_SectionOverlapingTraj().Val().AngleMaxSpeed();
}
const double & cXml_ParamGraphStereopolis::AngleMaxSpeed()const
{
return GS_SectionOverlapingTraj().Val().AngleMaxSpeed();
}
double & cXml_ParamGraphStereopolis::DistMaxTraj()
{
return GS_SectionOverlapingTraj().Val().DistMaxTraj();
}
const double & cXml_ParamGraphStereopolis::DistMaxTraj()const
{
return GS_SectionOverlapingTraj().Val().DistMaxTraj();
}
std::list< cOneInterv_OT > & cXml_ParamGraphStereopolis::OneInterv_OT()
{
return GS_SectionOverlapingTraj().Val().OneInterv_OT();
}
const std::list< cOneInterv_OT > & cXml_ParamGraphStereopolis::OneInterv_OT()const
{
return GS_SectionOverlapingTraj().Val().OneInterv_OT();
}
cTplValGesInit< cGS_SectionOverlapingTraj > & cXml_ParamGraphStereopolis::GS_SectionOverlapingTraj()
{
return mGS_SectionOverlapingTraj;
}
const cTplValGesInit< cGS_SectionOverlapingTraj > & cXml_ParamGraphStereopolis::GS_SectionOverlapingTraj()const
{
return mGS_SectionOverlapingTraj;
}
void BinaryUnDumpFromFile(cXml_ParamGraphStereopolis & anObj,ELISE_fp & aFp)
{
BinaryUnDumpFromFile(anObj.NameGrpC(),aFp);
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.GS_SectionLinear().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.GS_SectionLinear().ValForcedForUnUmp(),aFp);
}
else anObj.GS_SectionLinear().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.GS_SectionCross().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.GS_SectionCross().ValForcedForUnUmp(),aFp);
}
else anObj.GS_SectionCross().SetNoInit();
} ;
{ bool IsInit;
BinaryUnDumpFromFile(IsInit,aFp);
if (IsInit) {
anObj.GS_SectionOverlapingTraj().SetInitForUnUmp();
BinaryUnDumpFromFile(anObj.GS_SectionOverlapingTraj().ValForcedForUnUmp(),aFp);
}
else anObj.GS_SectionOverlapingTraj().SetNoInit();
} ;
}
void BinaryDumpInFile(ELISE_fp & aFp,const cXml_ParamGraphStereopolis & anObj)
{
BinaryDumpInFile(aFp,anObj.NameGrpC());
BinaryDumpInFile(aFp,anObj.GS_SectionLinear().IsInit());
if (anObj.GS_SectionLinear().IsInit()) BinaryDumpInFile(aFp,anObj.GS_SectionLinear().Val());
BinaryDumpInFile(aFp,anObj.GS_SectionCross().IsInit());
if (anObj.GS_SectionCross().IsInit()) BinaryDumpInFile(aFp,anObj.GS_SectionCross().Val());
BinaryDumpInFile(aFp,anObj.GS_SectionOverlapingTraj().IsInit());
if (anObj.GS_SectionOverlapingTraj().IsInit()) BinaryDumpInFile(aFp,anObj.GS_SectionOverlapingTraj().Val());
}
cElXMLTree * ToXMLTree(const cXml_ParamGraphStereopolis & anObj)
{
XMLPushContext(anObj.mGXml);
cElXMLTree * aRes = new cElXMLTree((cElXMLTree *)0,"Xml_ParamGraphStereopolis",eXMLBranche);
aRes->AddFils(::ToXMLTree(std::string("NameGrpC"),anObj.NameGrpC())->ReTagThis("NameGrpC"));
if (anObj.GS_SectionLinear().IsInit())
aRes->AddFils(ToXMLTree(anObj.GS_SectionLinear().Val())->ReTagThis("GS_SectionLinear"));
if (anObj.GS_SectionCross().IsInit())
aRes->AddFils(ToXMLTree(anObj.GS_SectionCross().Val())->ReTagThis("GS_SectionCross"));
if (anObj.GS_SectionOverlapingTraj().IsInit())
aRes->AddFils(ToXMLTree(anObj.GS_SectionOverlapingTraj().Val())->ReTagThis("GS_SectionOverlapingTraj"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
return aRes;
}
void xml_init(cXml_ParamGraphStereopolis & anObj,cElXMLTree * aTree)
{
if (aTree==0) return;
anObj.mGXml = aTree->mGXml;
xml_init(anObj.NameGrpC(),aTree->Get("NameGrpC",1)); //tototo
xml_init(anObj.GS_SectionLinear(),aTree->Get("GS_SectionLinear",1)); //tototo
xml_init(anObj.GS_SectionCross(),aTree->Get("GS_SectionCross",1)); //tototo
xml_init(anObj.GS_SectionOverlapingTraj(),aTree->Get("GS_SectionOverlapingTraj",1)); //tototo
}
std::string Mangling( cXml_ParamGraphStereopolis *) {return "C81DA2EEDFC08691FB3F";};
eRANSAC_HistoP Str2eRANSAC_HistoP(const std::string & aName)
{
if (aName=="eR3D")
return eR3D;
else if (aName=="eR2D")
return eR2D;
else if (aName=="eNbTypeRHP")
return eNbTypeRHP;
else
{
cout << aName << " is not a correct value for enum eRANSAC_HistoP\n" ;
ELISE_ASSERT(false,"XML enum value error");
}
return (eRANSAC_HistoP) 0;
}
void xml_init(eRANSAC_HistoP & aVal,cElXMLTree * aTree)
{
aVal= Str2eRANSAC_HistoP(aTree->Contenu());
}
std::string eToString(const eRANSAC_HistoP & anObj)
{
if (anObj==eR3D)
return "eR3D";
if (anObj==eR2D)
return "eR2D";
if (anObj==eNbTypeRHP)
return "eNbTypeRHP";
std::cout << "Enum = eRANSAC_HistoP\n";
ELISE_ASSERT(false,"Bad Value in eToString for enum value ");
return "";
}
cElXMLTree * ToXMLTree(const std::string & aNameTag,const eRANSAC_HistoP & anObj)
{
return cElXMLTree::ValueNode(aNameTag,eToString(anObj));
}
void BinaryDumpInFile(ELISE_fp & aFp,const eRANSAC_HistoP & anObj)
{
BinaryDumpInFile(aFp,int(anObj));
}
void BinaryUnDumpFromFile(eRANSAC_HistoP & anObj,ELISE_fp & aFp)
{
int aIVal;
BinaryUnDumpFromFile(aIVal,aFp);
anObj=(eRANSAC_HistoP) aIVal;
}
std::string Mangling( eRANSAC_HistoP *) {return "B8F97832255E9CE1FBBF";};
// };
|
//+---------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1995 - 2000
//
// File: PropRec.cxx
//
// Contents: Record format for persistent property store
//
// Classes: CPropertyRecord
//
// History: 28-Dec-19 KyleP Created
//
//----------------------------------------------------------------------------
#include <pch.cxx>
#pragma hdrstop
#include <stgvar.hxx>
#include <propvar.h>
#include <propstm.hxx>
#include <proprec.hxx>
#include <eventlog.hxx>
#include <pmalloc.hxx>
//+---------------------------------------------------------------------------
//
// Member: COnDiskPropertyRecord::ReadFixed, public
//
// Synopsis: Read fixed-length property
//
// Arguments: [Ordinal] -- Ordinal of property to locate.
// [mask] -- Bitmask of ordinal. Pre-computed for efficiency.
// [oStart] -- Offset to start of specific fixed property.
// [cTotal] -- Total number of properties in record.
// [Type] -- Data type of value
// [var] -- Value returned here.
// [pbExtra] -- Indirect data stored here
// [pcbExtra] -- On input, size of [pbExtra]. On output,
// amount used.
//
// History: 27-Dec-95 KyleP Created.
//
//----------------------------------------------------------------------------
void COnDiskPropertyRecord::ReadFixed( ULONG Ordinal,
ULONG Mask,
ULONG oStart,
ULONG cTotal,
ULONG Type,
PROPVARIANT & var,
BYTE * pbExtra,
unsigned * pcbExtra,
PStorage & storage )
{
if ( !IsStored( Ordinal, Mask ) )
{
var.vt = VT_EMPTY;
*pcbExtra = 0;
}
else
{
var.vt = (USHORT)Type;
//
// Start is after existance bitmap
//
ULONG const * pulStart = 0;
if (IsLeanRecord())
pulStart = &((SLeanRecord *)&Data)->_aul[ (cTotal-1) / 16 + 1 + oStart];
else
pulStart = &((SNormalRecord *)&Data)->_aul[ (cTotal-1) / 16 + 1 + oStart];
switch ( Type )
{
case VT_I1:
case VT_UI1:
var.bVal = *(BYTE *)pulStart;
*pcbExtra = 0;
break;
case VT_I2:
case VT_UI2:
case VT_BOOL:
var.uiVal = *(USHORT *)pulStart;
*pcbExtra = 0;
break;
case VT_I4:
case VT_UI4:
case VT_R4:
case VT_ERROR:
var.ulVal = *pulStart;
*pcbExtra = 0;
break;
case VT_I8:
case VT_UI8:
case VT_R8:
case VT_CY:
case VT_DATE:
case VT_FILETIME:
RtlCopyMemory( &var.hVal, pulStart, sizeof(var.hVal) );
*pcbExtra = 0;
break;
case VT_CLSID:
if ( *pcbExtra < sizeof(CLSID) )
{
*pcbExtra = sizeof(CLSID);
return;
}
if ( *pcbExtra == 0xFFFFFFFF )
{
var.puuid = (CLSID *)CoTaskMemAlloc( sizeof(CLSID) );
if ( 0 == var.puuid )
THROW( CException( E_OUTOFMEMORY ) );
}
else
{
*pcbExtra = sizeof(CLSID);
var.puuid = (CLSID *)pbExtra;
}
RtlCopyMemory( var.puuid, pulStart, sizeof(CLSID) );
break;
default:
ciDebugOut(( DEB_ERROR, "PROPSTORE: Reading invalid fixed type %d.\n", Type ));
Win4Assert( !"Corrupt property store" );
storage.ReportCorruptComponent( L"PropertyRecord1" );
THROW( CException( CI_CORRUPT_CATALOG ) );
break;
}
}
}
//+---------------------------------------------------------------------------
//
// Member: COnDiskPropertyRecord::ReadVariable, public
//
// Synopsis: Read variable-length property
//
// Arguments: [Ordinal] -- Ordinal of property to locate.
// [mask] -- Bitmask of ordinal. Pre-computed for efficiency.
// [oStart] -- Offset to start of variable storage area.
// [cTotal] -- Total number of properties in record.
// [cFixed] -- Count of fixed length properties
// [var] -- Value returned here.
// [pbExtra] -- Indirect data stored here
// [pcbExtra] -- On input, size of [pbExtra]. On output,
// amount used.
//
// Returns: FALSE if value must be stored in overflow record.
//
// History: 27-Dec-95 KyleP Created.
// 14-Mar-2000 KLam Check results of memory allocation
//
//----------------------------------------------------------------------------
BOOL COnDiskPropertyRecord::ReadVariable( ULONG Ordinal,
ULONG Mask,
ULONG oStart,
ULONG cTotal,
ULONG cFixed,
PROPVARIANT & var,
BYTE * pbExtra,
unsigned * pcbExtra )
{
if ( !IsStored( Ordinal, Mask ) )
{
var.vt = VT_EMPTY;
*pcbExtra = 0;
}
else
{
//
// Check for overflow.
//
if ( IsStoredOnOverflow( Ordinal, Mask ) )
return FALSE;
//
// Start is after existance bitmap and fixed properties.
//
ULONG * pulStart = FindVariableProp( Ordinal, cFixed, cTotal, oStart );
Win4Assert( !IsOverflow( *pulStart ) );
//
// Compute the length of the property.
//
ULONG cbProp = UsedSize( *pulStart ) * 4;
pulStart++; // Skip size field.
ciDebugOut(( DEB_PROPSTORE,
"Reading variable prop, ordinal %d at offset 0x%x (%d) in record. Size = %d bytes.\n",
Ordinal,
(ULONG)((ULONG_PTR)pulStart - (ULONG_PTR)this),
(ULONG)((ULONG_PTR)pulStart - (ULONG_PTR)this),
cbProp ));
ULONG cb;
BOOL fUnicodeSpecial = IsUnicodeSpecial( (SERIALIZEDPROPERTYVALUE *)pulStart,
cb );
if ( !fUnicodeSpecial )
cb = StgPropertyLengthAsVariant( (SERIALIZEDPROPERTYVALUE *)pulStart,
cbProp,
CP_WINUNICODE,
0 );
if ( cb <= *pcbExtra )
{
if ( *pcbExtra == 0xFFFFFFFF )
{
//
// Unmarshall the property. Use the OLE allocator for extra mem
//
if ( fUnicodeSpecial )
{
ReadUnicodeSpecialCTMA( (SERIALIZEDPROPERTYVALUE *)pulStart,
var );
}
else
{
CCoTaskMemAllocator BufferMgr;
StgConvertPropertyToVariant( (SERIALIZEDPROPERTYVALUE *)pulStart,
CP_WINUNICODE,
&var,
&BufferMgr );
}
#if CIDBG==1
if ( (var.vt&0x0fff) > VT_CLSID )
{
ciDebugOut(( DEB_ERROR, "Bad Variant Type 0x%X\n", var.vt ));
Win4Assert( !"Call KyleP" );
}
#endif // CIDBG==1
}
else
{
//
// Unmarshall the property into a buffer.
//
if ( fUnicodeSpecial )
{
ReadUnicodeSpecial( (SERIALIZEDPROPERTYVALUE *)pulStart,
var,
pbExtra );
}
else
{
CNonAlignAllocator BufferMgr( *pcbExtra, pbExtra );
StgConvertPropertyToVariant( (SERIALIZEDPROPERTYVALUE *)pulStart,
CP_WINUNICODE,
&var,
&BufferMgr );
// StgConverPropertyToVariant uses SafeArrayCreateEx for
// VT_ARRAY allocation, even when an allocator is passed in!
if ((var.vt & VT_ARRAY) == VT_ARRAY)
{
ciDebugOut(( DEB_ERROR, "Array Variant Type 0x%X\n", var.vt ));
Win4Assert(BufferMgr.GetFreeSize() == *pcbExtra);
SAFEARRAY * pSaSrc = var.parray;
SAFEARRAY * pSaDest = 0;
if ( SaCreateAndCopy( BufferMgr, pSaSrc, &pSaDest ) &&
SaCreateDataUsingMA( BufferMgr,
var.vt & ~VT_ARRAY,
*pSaSrc,
*pSaDest,
TRUE ) )
{
SafeArrayDestroy(var.parray);
var.parray = pSaDest;
}
else
{
Win4Assert( !"SafeArray copy failed!" );
}
}
else if ((var.vt & ~(VT_VECTOR|VT_ARRAY)) == VT_BSTR)
{
//
// StgConverPropertyToVariant uses SysAllocString for
// BSTR allocation, even when an allocator is passed in!
//
unsigned cbBstr;
switch ( var.vt )
{
case VT_BSTR:
{
Win4Assert(BufferMgr.GetFreeSize() == *pcbExtra);
cbBstr = BSTRLEN( var.bstrVal ) + sizeof(OLECHAR) + sizeof(DWORD);
BSTR bstr = (BSTR) BufferMgr.Allocate(cbBstr);
if ( 0 == bstr )
{
THROW ( CException ( E_OUTOFMEMORY ) );
}
RtlCopyMemory( bstr, &BSTRLEN(var.bstrVal), cbBstr );
SysFreeString( var.bstrVal );
var.bstrVal = (BSTR) (((DWORD *)bstr) + 1);
break;
}
case VT_BSTR|VT_VECTOR:
{
//
// The vector pointer storage is allocated
// using our allocator, but the bstrs are
// allocated using SysAllocString.
//
for ( unsigned i = 0; i < var.cabstr.cElems; i++ )
{
cbBstr = BSTRLEN( var.cabstr.pElems[i] ) +
sizeof(OLECHAR) + sizeof (DWORD);
BSTR bstr = (BSTR) BufferMgr.Allocate(cbBstr);
if ( 0 == bstr )
{
THROW ( CException ( E_OUTOFMEMORY ) );
}
RtlCopyMemory( bstr,
&BSTRLEN(var.cabstr.pElems[i]),
cbBstr);
SysFreeString(var.cabstr.pElems[i]);
var.cabstr.pElems[i] = (BSTR) (((DWORD *) bstr) + 1);
}
break;
}
}
}
else if (var.vt == (VT_VECTOR|VT_VARIANT))
{
ciDebugOut(( DEB_ERROR, "ReadVariable - Variant Vector Type\n" ));
}
}
#if CIDBG==1
if ( (var.vt&0x0fff) > VT_CLSID )
{
ciDebugOut(( DEB_ERROR, "Bad Variant Type 0x%X\n", var.vt ));
Win4Assert( !"Call KyleP" );
}
#endif // CIDBG==1
}
}
*pcbExtra = cb;
}
return TRUE;
}
//+---------------------------------------------------------------------------
//
// Member: COnDiskPropertyRecord::WriteFixed, public
//
// Synopsis: Write fixed-length property
//
// Arguments: [Ordinal] -- Ordinal of property to locate.
// [mask] -- Bitmask of ordinal. Pre-computed for efficiency.
// [oStart] -- Offset to start of specific property.
// [Type] -- Expected data type (for type checking)
// [cTotal] -- Total number of properties in record.
// [var] -- Value to store.
//
// History: 27-Dec-95 KyleP Created.
//
//----------------------------------------------------------------------------
void COnDiskPropertyRecord::WriteFixed( ULONG Ordinal,
ULONG Mask,
ULONG oStart,
ULONG Type,
ULONG cTotal,
CStorageVariant const & var )
{
if ( var.Type() != (VARENUM)Type )
{
# if CIDBG == 1
if ( var.Type() != VT_EMPTY )
ciDebugOut(( DEB_WARN, "Type mismatch (%d vs. %d) writing fixed property\n",
var.Type(), Type ));
# endif
ClearStored( Ordinal, Mask );
return;
}
//
// Start is after existance bitmap
//
ULONG * pulStart = 0;
if (IsLeanRecord())
pulStart = &((SLeanRecord *)&Data)->_aul[ (cTotal-1) / 16 + 1 + oStart];
else
pulStart = &((SNormalRecord *)&Data)->_aul[ (cTotal-1) / 16 + 1 + oStart];
ciDebugOut(( DEB_PROPSTORE,
"Writing fixed prop, ordinal %d (type %d) at offset 0x%x (%d) in record.\n",
Ordinal,
var.Type(),
(ULONG)((ULONG_PTR)pulStart - (ULONG_PTR)this),
(ULONG)((ULONG_PTR)pulStart - (ULONG_PTR)this) ));
switch ( var.Type() )
{
case VT_I1:
case VT_UI1:
{
ULONG ul = var.GetUI1();
*pulStart = ul;
}
break;
case VT_I2:
case VT_UI2:
case VT_BOOL:
{
ULONG ul = var.GetUI2();
*pulStart = ul;
}
break;
case VT_I4:
case VT_UI4:
case VT_R4:
case VT_ERROR:
*pulStart = var.GetUI4();
break;
case VT_I8:
case VT_UI8:
case VT_R8:
case VT_CY:
case VT_DATE:
case VT_FILETIME:
{
ULARGE_INTEGER uli = var.GetUI8();
RtlCopyMemory( pulStart, &uli, sizeof(uli) );
}
break;
case VT_CLSID:
RtlCopyMemory( pulStart, var.GetCLSID(), sizeof(CLSID) );
break;
default:
Win4Assert( !"How did I get here?" );
ClearStored( Ordinal, Mask );
break;
}
SetStored( Ordinal, Mask );
}
//+---------------------------------------------------------------------------
//
// Member: COnDiskPropertyRecord::WriteVariable, public
//
// Synopsis: Write variable-length property
//
// Arguments: [Ordinal] -- Ordinal of property to locate.
// [mask] -- Bitmask of ordinal. Pre-computed for efficiency.
// [oStart] -- Offset to start of variable length area.
// [cTotal] -- Total number of properties in record.
// [cFixed] -- Count of fixed length properties
// [culRec] -- Size (in dwords) of record
// [var] -- Value to store.
//
// Returns: FALSE if record must be stored in overflow record.
//
// History: 27-Dec-95 KyleP Created.
//
//----------------------------------------------------------------------------
BOOL COnDiskPropertyRecord::WriteVariable( ULONG Ordinal,
ULONG Mask,
ULONG oStart,
ULONG cTotal,
ULONG cFixed,
ULONG culRec,
CStorageVariant const & var,
PStorage & storage )
{
Win4Assert(!IsLeanRecord());
ULONG * pulStart = FindVariableProp( Ordinal, cFixed, cTotal, oStart );
//
// Are we freeing this property?
//
if ( var.Type() == VT_EMPTY )
{
ClearStored( Ordinal, Mask );
ClearStoredOnOverflow( Ordinal, Mask );
//
// Overflow case: We need to fake the overflow to clean up linked records.
//
if ( IsOverflow( *pulStart ) )
{
SetUsedSize( pulStart, 0 );
return FALSE;
}
else
{
//
// Adjust size field, and total variable space for record.
//
Win4Assert( VariableUsed() >= UsedSize( *pulStart ) );
SetVariableUsed(VariableUsed() - UsedSize( *pulStart ));
SetUsedSize( pulStart, 0 );
return TRUE;
}
}
//
// No matter what happens, we want to indicate the property was stored.
//
SetStored( Ordinal, Mask );
ClearStoredOnOverflow( Ordinal, Mask );
//
// Compute the length of the property.
//
ULONG cul = 0;
BOOL fUnicodeSpecial = IsUnicodeSpecial( var, cul );
if ( !fUnicodeSpecial )
{
StgConvertVariantToProperty( (PROPVARIANT *)(ULONG_PTR)&var,
CP_WINUNICODE,
0,
&cul,
pidInvalid,
FALSE,
0 );
Win4Assert( cul > 0 );
cul = (cul - 1) / sizeof(ULONG) + 1;
}
ULONG culPrevUsed = UsedSize( *pulStart );
//
// Do we fit?
//
if ( cul > AllocatedSize( *pulStart ) )
{
//
// Can we fit?
//
if ( cul >
UsedSize( *pulStart ) + FreeVariableSpace( cTotal, cFixed, oStart, culRec ) )
{
ciDebugOut(( DEB_PROPSTORE, "Need overflow buffer for ordinal %u\n", Ordinal ));
//
// If we had a previous value, adjust total variable space for record.
//
if ( !IsOverflow( *pulStart ) )
{
Win4Assert( VariableUsed() >= UsedSize( *pulStart ) );
SetVariableUsed(VariableUsed() - UsedSize( *pulStart ));
}
MarkOverflow( pulStart );
SetStoredOnOverflow( Ordinal, Mask );
return FALSE;
}
//
// Need to move properties, but there *is* room in record for the shift.
//
//
// First, compress previous properties.
//
#if CIDBG
ULONG * pulOldStart = pulStart;
#endif
pulStart = LeftCompress( FindVariableProp( cFixed, cFixed, cTotal, oStart ),
0,
pulStart );
ciDebugOut(( DEB_PROPSTORE,
"Freeing up %d bytes for variable prop %d via left compression\n",
(pulOldStart - pulStart) * 4,
Ordinal ));
//
// Then, if needed, push additional properties farther out.
//
if ( cul > AllocatedSize( *pulStart ) )
{
ULONG * pulNext = pulStart + AllocatedSize(*pulStart) + 1;
ULONG culDelta = cul - AllocatedSize(*pulStart);
ciDebugOut(( DEB_PROPSTORE,
"Freeing up %d bytes for variable prop %d, starting at offset 0x%x (%d) via right compression\n",
culDelta * 4,
Ordinal,
(ULONG)((ULONG_PTR)pulNext - (ULONG_PTR)this),
(ULONG)((ULONG_PTR)pulNext - (ULONG_PTR)this) ));
Win4Assert( Ordinal < cTotal );
RightCompress( pulNext, // Next property
culDelta, // Amount to shift
cTotal - Ordinal - 1 ); // # props left in record
SetAllocatedSize( pulStart, cul );
}
Win4Assert( cul <= AllocatedSize( *pulStart ) );
}
//
// Adjust size field, and total variable space for record.
//
SetVariableUsed(VariableUsed() + cul - culPrevUsed);
SetUsedSize( pulStart, cul );
pulStart++; // Skip size field
Win4Assert( AllocatedSize( *(pulStart - 1)) >= UsedSize( *(pulStart - 1) ) );
ciDebugOut(( DEB_PROPSTORE,
"Writing variable prop, ordinal %d at offset 0x%x (%d) in record. Size = %d bytes.\n",
Ordinal,
(ULONG)((ULONG_PTR)pulStart - (ULONG_PTR)this),
(ULONG)((ULONG_PTR)pulStart - (ULONG_PTR)this),
UsedSize(*(pulStart - 1)) * 4 ));
if ( fUnicodeSpecial )
{
WriteUnicodeSpecial( var, (SERIALIZEDPROPERTYVALUE *)pulStart );
}
else
{
cul *= 4;
if ( 0 == StgConvertVariantToProperty( (PROPVARIANT *)(ULONG_PTR)&var,
CP_WINUNICODE,
(SERIALIZEDPROPERTYVALUE *)pulStart,
&cul,
pidInvalid,
FALSE,
0 ) )
{
ciDebugOut(( DEB_ERROR, "Error marshalling property!\n" ));
Win4Assert( !"Corrupt property store" );
storage.ReportCorruptComponent( L"PropertyRecord2" );
THROW( CException( CI_CORRUPT_CATALOG ) );
}
}
return TRUE;
}
//+---------------------------------------------------------------------------
//
// Member: COnDiskPropertyRecord::CountNormalRecordsToStore, public
//
// Synopsis: Compute size of value
//
// Arguments: [cTotal] -- Total number of properties in record.
// [culRec] -- Size (in dwords) of record
// [var] -- Value to store.
//
// Returns: Size in records needed to store property.
//
// History: 27-Dec-95 KyleP Created.
//
//----------------------------------------------------------------------------
ULONG COnDiskPropertyRecord::CountNormalRecordsToStore( ULONG cTotal,
ULONG culRec,
CStorageVariant const & var )
{
//
// Compute the length of the property.
//
ULONG cul = 0;
BOOL fUnicodeSpecial = IsUnicodeSpecial( var, cul );
if ( !fUnicodeSpecial )
{
StgConvertVariantToProperty( (PROPVARIANT *)(ULONG_PTR)&var,
CP_WINUNICODE,
0,
&cul,
pidInvalid,
FALSE,
0 );
Win4Assert( cul > 0 );
cul = (cul - 1) / sizeof(ULONG) + 1;
}
//
// Add on the fixed overhead. We are computing cul to determine the number
// of records to use as a single overflow record. Since we will end up with
// a record of length >= culRec, we are assured that the overflow record has
// enough space for free list mgmt. Hence we don't need to account for space
// required for free list mgmt when computing cul.
//
cul += MinimalOverheadNormal() + // Minimal overhead for normal records
(cTotal - 1) / 16 + 1 + // Existence bitmap
cTotal; // Used/Alloc sizes
return (cul - 1) / culRec + 1;
}
//+---------------------------------------------------------------------------
//
// Member: COnDiskPropertyRecord::RightCompress, public
//
// Synopsis: Moves data from [pul], [cul] dwords up.
//
// Arguments: [pul] -- Start of area to move.
// [cul] -- Count of dwords to move
// [cRemaining] -- Count of values remaining in buffer. Needed
// because it is impossible to distinguish
// used/alloc blocks from empty space.
//
// History: 27-Dec-95 KyleP Created.
//
//----------------------------------------------------------------------------
void COnDiskPropertyRecord::RightCompress( ULONG * pul, ULONG cul, ULONG cRemaining )
{
//
// Termination condition for recursion: We've scanned all variable
// properties in this record. Any remaining space in record is
// guaranteed to be free.
//
if ( 0 == cRemaining )
return;
ULONG FreeSpace = AllocatedSize(*pul) - UsedSize(*pul);
if ( FreeSpace >= cul )
{
SetAllocatedSize( pul, AllocatedSize(*pul) - cul );
}
else
{
RightCompress( pul + AllocatedSize(*pul) + 1, cul - FreeSpace, cRemaining - 1 );
SetAllocatedSize( pul, UsedSize(*pul) );
}
RtlMoveMemory( pul + cul, pul, (UsedSize(*pul) + 1) * 4 );
}
//+---------------------------------------------------------------------------
//
// Member: COnDiskPropertyRecord::LeftCompress, public
//
// Synopsis: Moves data from [pul], [cul] dwords down.
//
// Arguments: [pul] -- Start of area to move.
// [cul] -- Count of dwords to move
// [pulEnd] -- Terminating property. This property will have
// it's allocated size increased with all the slack
// from previous properties and have its used size
// set to 0.
//
// Returns: New pointer to pulEnd (which moved down by [cul] bytes).
//
// History: 27-Dec-95 KyleP Created.
//
//----------------------------------------------------------------------------
ULONG * COnDiskPropertyRecord::LeftCompress( ULONG * pul, ULONG cul, ULONG * pulEnd )
{
//
// Terminating recursion? Just copy the allocated info. Used size is
// zero, because data isn't copied.
//
if ( pul == pulEnd )
{
pul -= cul;
SetAllocatedSize( pul, AllocatedSize(*pulEnd) + cul );
SetUsedSize( pul, 0 );
return pul;
}
//
// First, move current record.
//
if ( cul > 0 )
{
RtlMoveMemory( pul - cul, pul, (UsedSize(*pul) + 1) * 4 );
pul -= cul;
}
//
// Adjust allocation size.
//
cul += ( AllocatedSize(*pul) - UsedSize(*pul) );
SetAllocatedSize( pul, UsedSize(*pul) );
return LeftCompress( pul + cul + UsedSize(*pul) + 1, cul, pulEnd );
}
//+---------------------------------------------------------------------------
//
// Member: COnDiskPropertyRecord::IsUnicodeSpecial, private
//
// Synopsis: Determines if variant is Unicode string with all 0 high bytes.
//
// Arguments: [var] -- Variant to check
// [cul] -- On TRUE, returns count of DWORDs needed to store
//
// Returns: TRUE if [var] is a Unicode string with all 0 high bytes.
//
// History: 17-Jul-97 KyleP Created
//
//----------------------------------------------------------------------------
BOOL COnDiskPropertyRecord::IsUnicodeSpecial( CStorageVariant const & var,
ULONG & cul )
{
if ( VT_LPWSTR != var.Type() )
return FALSE;
//
// Loop through string, looking for non-null high bytes.
//
for ( WCHAR const * pwc = var.GetLPWSTR();
0 != *pwc && 0 == (*pwc & 0xFF00 );
pwc++ )
{
continue; // Null body
}
cul = 1 + // Type (VT_ILLEGAL)
1 + // Size
(ULONG)(pwc - var.GetLPWSTR() + 3) / sizeof(ULONG); // Characters
return (0 == *pwc);
}
//+---------------------------------------------------------------------------
//
// Member: COnDiskPropertyRecord::IsUnicodeSpecial, private
//
// Synopsis: Determines if serialized property is stored in special
// compressed Unicode format.
//
// Arguments: [pProp] -- Serialized buffer to check.
// [cb] -- On TRUE, returns size in bytes of deserialized
// string.
//
// Returns: TRUE if [pProp] contains Unicode string serialized in special
// format.
//
// History: 17-Jul-97 KyleP Created
//
//----------------------------------------------------------------------------
BOOL COnDiskPropertyRecord::IsUnicodeSpecial( SERIALIZEDPROPERTYVALUE const * pProp,
ULONG & cb )
{
if ( VT_ILLEGAL != pProp->dwType )
return FALSE;
cb = ((*(ULONG *)pProp->rgb) + 1) * sizeof(WCHAR);
return TRUE;
}
//+---------------------------------------------------------------------------
//
// Member: COnDiskPropertyRecord::WriteUnicodeSpecial, private
//
// Synopsis: Serializes 'Special' Unicode string to buffer.
//
// Arguments: [var] -- Contains Unicode string
// [pProp] -- Serialize to here
//
// History: 17-Jul-97 KyleP Created
//
//----------------------------------------------------------------------------
void COnDiskPropertyRecord::WriteUnicodeSpecial( CStorageVariant const & var,
SERIALIZEDPROPERTYVALUE * pProp )
{
Win4Assert( VT_LPWSTR == var.Type() );
pProp->dwType = VT_ILLEGAL;
WCHAR const * pwcIn = var.GetLPWSTR();
for ( unsigned i = 0; 0 != *pwcIn; i++, pwcIn++ )
{
Win4Assert( 0 == (*pwcIn & 0xFF00) );
pProp->rgb[4 + i] = (BYTE)(*pwcIn);
}
*(ULONG *)pProp->rgb = i;
}
//+---------------------------------------------------------------------------
//
// Member: COnDiskPropertyRecord::ReadUnicodeSpecial, private
//
// Synopsis: Deserializes Unicode string stored in 'Special' format.
//
// Arguments: [pProp] -- Serialized buffer
// [var] -- Variant written here
// [pbExtra] -- Memory to use for string itself
//
// History: 17-Jul-97 KyleP Created
//
//----------------------------------------------------------------------------
void COnDiskPropertyRecord::ReadUnicodeSpecial( SERIALIZEDPROPERTYVALUE const * pProp,
PROPVARIANT & var,
BYTE * pbExtra )
{
Win4Assert( VT_ILLEGAL == pProp->dwType );
var.vt = VT_LPWSTR;
ULONG cc = *(ULONG *)pProp->rgb;
var.pwszVal = (WCHAR *)pbExtra;
for ( unsigned i = 0; i < cc; i++ )
{
var.pwszVal[i] = pProp->rgb[4+i];
}
var.pwszVal[i] = 0;
}
//+---------------------------------------------------------------------------
//
// Member: COnDiskPropertyRecord::ReadUnicodeSpecial, private
//
// Synopsis: Deserializes Unicode string stored in 'Special' format. This
// version uses CoTaskMemAlloc for additional memory.
//
// Arguments: [pProp] -- Serialized buffer
// [var] -- Variant written here
//
// History: 17-Jul-97 KyleP Created
//
//----------------------------------------------------------------------------
void COnDiskPropertyRecord::ReadUnicodeSpecialCTMA( SERIALIZEDPROPERTYVALUE const * pProp,
PROPVARIANT & var )
{
Win4Assert( VT_ILLEGAL == pProp->dwType );
var.vt = VT_LPWSTR;
ULONG cc = *(ULONG *)pProp->rgb;
var.pwszVal = (WCHAR *)CoTaskMemAlloc( (cc + 1)*sizeof(WCHAR) );
if ( 0 == var.pwszVal )
{
THROW( CException( E_OUTOFMEMORY ) );
}
for ( unsigned i = 0; i < cc; i++ )
{
var.pwszVal[i] = pProp->rgb[4+i];
}
var.pwszVal[i] = 0;
}
|
#include "trajopt/problem_description.hpp"
#include "trajopt/common.hpp"
#include <boost/foreach.hpp>
#include "utils/logging.hpp"
#include "sco/expr_ops.hpp"
#include "sco/expr_op_overloads.hpp"
#include "trajopt/kinematic_terms.hpp"
#include "trajopt/trajectory_costs.hpp"
#include "trajopt/collision_terms.hpp"
#include "trajopt/rave_utils.hpp"
#include "trajopt/rave_utils.hpp"
#include "trajopt/traj_plotter.hpp"
#include "utils/eigen_conversions.hpp"
#include "utils/eigen_slicing.hpp"
#include <boost/algorithm/string.hpp>
#include "sco/optimizers.hpp"
using namespace Json;
using namespace std;
using namespace OpenRAVE;
using namespace trajopt;
using namespace util;
namespace {
bool gRegisteredMakers = false;
void ensure_only_members(const Value& v, const char** fields, int nvalid) {
for (Json::ValueConstIterator it = v.begin(); it != v.end(); ++it) {
bool valid = false;
for (int j=0; j < nvalid; ++j) {
if ( strcmp(it.memberName(), fields[j]) == 0) {
valid = true;
break;
}
}
if (!valid) {
PRINT_AND_THROW( boost::format("invalid field found: %s")%it.memberName());
}
}
}
void RegisterMakers() {
TermInfo::RegisterMaker("pose", &PoseCostInfo::create);
TermInfo::RegisterMaker("joint_pos", &JointPosCostInfo::create);
TermInfo::RegisterMaker("joint_vel", &JointVelCostInfo::create);
TermInfo::RegisterMaker("collision", &CollisionCostInfo::create);
TermInfo::RegisterMaker("joint", &JointConstraintInfo::create);
TermInfo::RegisterMaker("cart_vel", &CartVelCntInfo::create);
TermInfo::RegisterMaker("joint_vel_limits", &JointVelConstraintInfo::create);
gRegisteredMakers = true;
}
RobotAndDOFPtr RADFromName(const string& name, RobotBasePtr robot) {
if (name == "active") {
return RobotAndDOFPtr(new RobotAndDOF(robot, robot->GetActiveDOFIndices(), robot->GetAffineDOF(), robot->GetAffineRotationAxis()));
}
vector<int> dof_inds;
int affinedofs = 0;
Vector rotationaxis(0,0,1);
vector<string> components;
boost::split(components, name, boost::is_any_of("+"));
for (int i=0; i < components.size(); ++i) {
std::string& component = components[i];
if (RobotBase::ManipulatorPtr manip = GetManipulatorByName(*robot, component)) {
vector<int> inds = manip->GetArmIndices();
dof_inds.insert(dof_inds.end(), inds.begin(), inds.end());
}
else if (component == "base") {
affinedofs |= DOF_X | DOF_Y | DOF_RotationAxis;
}
else if (KinBody::JointPtr joint = robot->GetJoint(component)) {
dof_inds.push_back(joint->GetDOFIndex());
}
else PRINT_AND_THROW( boost::format("error in reading manip description: %s must be a manipulator, link, or 'base'")%component );
}
return RobotAndDOFPtr(new RobotAndDOF(robot, dof_inds, affinedofs, rotationaxis));
}
#if 0
BoolVec toMask(const VectorXd& x) {
BoolVec out(x.size());
for (int i=0; i < x.size(); ++i) out[i] = (x[i] > 0);
return out;
}
#endif
bool allClose(const VectorXd& a, const VectorXd& b) {
return (a-b).array().abs().maxCoeff() < 1e-4;
}
}
namespace Json { //funny thing with two-phase lookup
void fromJson(const Json::Value& v, Vector3d& x) {
vector<double> vx;
fromJsonArray(v, vx, 3);
x = Vector3d(vx[0], vx[1], vx[2]);
}
void fromJson(const Json::Value& v, Vector4d& x) {
vector<double> vx;
fromJsonArray(v, vx, 4);
x = Vector4d(vx[0], vx[1], vx[2], vx[3]);
}
}
namespace trajopt {
TRAJOPT_API ProblemConstructionInfo* gPCI;
void BasicInfo::fromJson(const Json::Value& v) {
childFromJson(v, start_fixed, "start_fixed", true);
childFromJson(v, n_steps, "n_steps");
childFromJson(v, manip, "manip");
childFromJson(v, robot, "robot", string(""));
childFromJson(v, dofs_fixed, "dofs_fixed", IntVec());
// TODO: optimization parameters, etc?
}
////
bool gReadingCosts=false, gReadingConstraints=false;
void fromJson(const Json::Value& v, TermInfoPtr& term) {
string type;
childFromJson(v, type, "type");
LOG_DEBUG("reading term: %s", type.c_str());
term = TermInfo::fromName(type);
if (gReadingCosts) {
if (!term) PRINT_AND_THROW( boost::format("failed to construct cost named %s")%type );
if (!dynamic_cast<MakesCost*>(term.get())) PRINT_AND_THROW( boost::format("%s is only a constraint, but you listed it as a cost")%type) ;
term->term_type = TT_COST;
}
else if (gReadingConstraints) {
if (!term) PRINT_AND_THROW( boost::format("failed to construct constraint named %s")%type );
if (!dynamic_cast<MakesConstraint*>(term.get())) PRINT_AND_THROW( boost::format("%s is only a cost, but you listed it as a constraint")%type);
term->term_type = TT_CNT;
}
else assert(0 && "shouldnt happen");
term->fromJson(v);
childFromJson(v, term->name, "name", type);
}
std::map<string, TermInfo::MakerFunc> TermInfo::name2maker;
void TermInfo::RegisterMaker(const std::string& type, MakerFunc f) {
name2maker[type] = f;
}
TermInfoPtr TermInfo::fromName(const string& type) {
if (!gRegisteredMakers) RegisterMakers();
if (name2maker.find(type) != name2maker.end()) {
return (*name2maker[type])();
}
else {
RAVELOG_ERROR("There is no cost of type %s\n", type.c_str());
return TermInfoPtr();
}
}
void InitInfo::fromJson(const Json::Value& v) {
string type_str;
childFromJson(v, type_str, "type");
int n_steps = gPCI->basic_info.n_steps;
int n_dof = gPCI->rad->GetDOF();
if (type_str == "stationary") {
data = toVectorXd(gPCI->rad->GetDOFValues()).transpose().replicate(n_steps, 1);
}
else if (type_str == "given_traj") {
FAIL_IF_FALSE(v.isMember("data"));
const Value& vdata = v["data"];
if (vdata.size() != n_steps) {
PRINT_AND_THROW("given initialization traj has wrong length");
}
data.resize(n_steps, n_dof);
for (int i=0; i < n_steps; ++i) {
DblVec row;
fromJsonArray(vdata[i], row, n_dof);
data.row(i) = toVectorXd(row);
}
}
else if (type_str == "straight_line") {
FAIL_IF_FALSE(v.isMember("endpoint"));
DblVec endpoint;
childFromJson(v, endpoint, "endpoint");
if (endpoint.size() != n_dof) {
PRINT_AND_THROW(boost::format("wrong number of dof values in initialization. expected %i got %j")%n_dof%endpoint.size());
}
data = TrajArray(n_steps, n_dof);
DblVec start = gPCI->rad->GetDOFValues();
for (int idof = 0; idof < n_dof; ++idof) {
data.col(idof) = VectorXd::LinSpaced(n_steps, start[idof], endpoint[idof]);
}
}
}
void ProblemConstructionInfo::fromJson(const Value& v) {
childFromJson(v, basic_info, "basic_info");
RobotBasePtr robot = (basic_info.robot=="") ? GetRobot(*env) : GetRobotByName(*env, basic_info.robot);
if (!robot) {
PRINT_AND_THROW("couldn't get robot");
}
rad = RADFromName(basic_info.manip, robot);
if (!rad) {
PRINT_AND_THROW( boost::format("couldn't get manip %s")%basic_info.manip );
}
gPCI = this;
gReadingCosts=true;
gReadingConstraints=false;
if (v.isMember("costs")) fromJsonArray(v["costs"], cost_infos);
gReadingCosts=false;
gReadingConstraints=true;
if (v.isMember("constraints")) fromJsonArray(v["constraints"], cnt_infos);
gReadingConstraints=false;
childFromJson(v, init_info, "init_info");
gPCI = NULL;
}
TrajOptResult::TrajOptResult(OptResults& opt, TrajOptProb& prob) :
cost_vals(opt.cost_vals),
cnt_viols(opt.cnt_viols) {
BOOST_FOREACH(const CostPtr& cost, prob.getCosts()) {
cost_names.push_back(cost->name());
}
BOOST_FOREACH(const ConstraintPtr& cnt, prob.getConstraints()) {
cnt_names.push_back(cnt->name());
}
traj = getTraj(opt.x, prob.GetVars());
}
TrajOptResultPtr OptimizeProblem(TrajOptProbPtr prob, bool plot) {
Configuration::SaverPtr saver = prob->GetRAD()->Save();
BasicTrustRegionSQP opt(prob);
opt.max_iter_ = 40;
opt.min_approx_improve_frac_ = .001;
opt.improve_ratio_threshold_ = .2;
opt.merit_error_coeff_ = 20;
if (plot) {
SetupPlotting(*prob, opt);
}
opt.initialize(trajToDblVec(prob->GetInitTraj()));
opt.optimize();
return TrajOptResultPtr(new TrajOptResult(opt.results(), *prob));
}
TrajOptProbPtr ConstructProblem(const ProblemConstructionInfo& pci) {
const BasicInfo& bi = pci.basic_info;
int n_steps = bi.n_steps;
TrajOptProbPtr prob(new TrajOptProb(n_steps, pci.rad));
int n_dof = prob->m_rad->GetDOF();
DblVec cur_dofvals = prob->m_rad->GetDOFValues();
if (bi.start_fixed) {
if (pci.init_info.data.rows() > 0 && !allClose(toVectorXd(cur_dofvals), pci.init_info.data.row(0))) {
PRINT_AND_THROW( "robot dof values don't match initialization. I don't know what you want me to use for the dof values");
}
for (int j=0; j < n_dof; ++j) {
prob->addLinearConstraint(exprSub(AffExpr(prob->m_traj_vars(0,j)), cur_dofvals[j]), EQ);
}
}
if (!bi.dofs_fixed.empty()) {
BOOST_FOREACH(const int& dof_ind, bi.dofs_fixed) {
for (int i=1; i < prob->GetNumSteps(); ++i) {
prob->addLinearConstraint(exprSub(AffExpr(prob->m_traj_vars(i,dof_ind)), AffExpr(prob->m_traj_vars(0,dof_ind))), EQ);
}
}
}
BOOST_FOREACH(const TermInfoPtr& ci, pci.cost_infos) {
ci->hatch(*prob);
}
BOOST_FOREACH(const TermInfoPtr& ci, pci.cnt_infos) {
ci->hatch(*prob);
}
prob->SetInitTraj(pci.init_info.data);
return prob;
}
TrajOptProbPtr ConstructProblem(const Json::Value& root, OpenRAVE::EnvironmentBasePtr env) {
ProblemConstructionInfo pci(env);
pci.fromJson(root);
return ConstructProblem(pci);
}
TrajOptProb::TrajOptProb(int n_steps, ConfigurationPtr rad) : m_rad(rad) {
DblVec lower, upper;
m_rad->GetDOFLimits(lower, upper);
int n_dof = m_rad->GetDOF();
// put optimization joint limits a little inside robot joint limits
// so numerical derivs work
#if OPENRAVE_VERSION_MINOR <= 8
for (int i=0; i < n_dof; ++i) lower[i] += 1e-4;
for (int i=0; i < n_dof; ++i) upper[i] -= 1e-4;
#endif
vector<double> vlower, vupper;
vector<string> names;
for (int i=0; i < n_steps; ++i) {
vlower.insert(vlower.end(), lower.data(), lower.data()+lower.size());
vupper.insert(vupper.end(), upper.data(), upper.data()+upper.size());
for (unsigned j=0; j < n_dof; ++j) {
names.push_back( (boost::format("j_%i_%i")%i%j).str() );
}
}
VarVector trajvarvec = createVariables(names, vlower, vupper);
m_traj_vars = VarArray(n_steps, n_dof, trajvarvec.data());
m_trajplotter.reset(new TrajPlotter(m_rad->GetEnv(), m_rad, m_traj_vars));
}
TrajOptProb::TrajOptProb() {
}
void SetupPlotting(TrajOptProb& prob, Optimizer& opt) {
TrajPlotterPtr plotter = prob.GetPlotter();
plotter->Add(prob.getCosts());
plotter->Add(prob.getConstraints());
opt.addCallback(boost::bind(&TrajPlotter::OptimizerCallback, *plotter, _1, _2));
}
void PoseCostInfo::fromJson(const Value& v) {
FAIL_IF_FALSE(v.isMember("params"));
const Value& params = v["params"];
childFromJson(params, timestep, "timestep", gPCI->basic_info.n_steps-1);
childFromJson(params, xyz,"xyz");
childFromJson(params, wxyz,"wxyz");
childFromJson(params, pos_coeffs,"pos_coeffs", (Vector3d)Vector3d::Ones());
childFromJson(params, rot_coeffs,"rot_coeffs", (Vector3d)Vector3d::Ones());
string linkstr;
childFromJson(params, linkstr, "link");
link = GetLinkMaybeAttached(gPCI->rad->GetRobot(), linkstr);
if (!link) {
PRINT_AND_THROW(boost::format("invalid link name: %s")%linkstr);
}
const char* all_fields[] = {"timestep", "xyz", "wxyz", "pos_coeffs", "rot_coeffs","link"};
ensure_only_members(params, all_fields, sizeof(all_fields)/sizeof(char*));
}
void PoseCostInfo::hatch(TrajOptProb& prob) {
VectorOfVectorPtr f(new CartPoseErrCalculator(toRaveTransform(wxyz, xyz), prob.GetRAD(), link));
if (term_type == TT_COST) {
prob.addCost(CostPtr(new CostFromErrFunc(f, prob.GetVarRow(timestep), concat(rot_coeffs, pos_coeffs), ABS, name)));
}
else if (term_type == TT_CNT) {
prob.addConstraint(ConstraintPtr(new ConstraintFromFunc(f, prob.GetVarRow(timestep), concat(rot_coeffs, pos_coeffs), EQ, name)));
}
prob.GetPlotter()->Add(PlotterPtr(new CartPoseErrorPlotter(f, prob.GetVarRow(timestep))));
prob.GetPlotter()->AddLink(link);
}
void JointPosCostInfo::fromJson(const Value& v) {
FAIL_IF_FALSE(v.isMember("params"));
int n_steps = gPCI->basic_info.n_steps;
const Value& params = v["params"];
childFromJson(params, vals, "vals");
childFromJson(params, coeffs, "coeffs");
if (coeffs.size() == 1) coeffs = DblVec(n_steps, coeffs[0]);
int n_dof = gPCI->rad->GetDOF();
if (vals.size() != n_dof) {
PRINT_AND_THROW( boost::format("wrong number of dof vals. expected %i got %i")%n_dof%vals.size());
}
childFromJson(params, timestep, "timestep", gPCI->basic_info.n_steps-1);
const char* all_fields[] = {"vals", "coeffs", "timestep"};
ensure_only_members(params, all_fields, sizeof(all_fields)/sizeof(char*));
}
void JointPosCostInfo::hatch(TrajOptProb& prob) {
prob.addCost(CostPtr(new JointPosCost(prob.GetVarRow(timestep), toVectorXd(vals), toVectorXd(coeffs))));
prob.getCosts().back()->setName(name);
}
void CartVelCntInfo::fromJson(const Value& v) {
FAIL_IF_FALSE(v.isMember("params"));
const Value& params = v["params"];
childFromJson(params, first_step, "first_step");
childFromJson(params, last_step, "last_step");
childFromJson(params, max_displacement,"max_displacement");
FAIL_IF_FALSE((first_step >= 0) && (first_step <= gPCI->basic_info.n_steps-1) && (first_step < last_step));
FAIL_IF_FALSE((last_step > 0) && (last_step <= gPCI->basic_info.n_steps-1));
string linkstr;
childFromJson(params, linkstr, "link");
link = gPCI->rad->GetRobot()->GetLink(linkstr);
if (!link) {
PRINT_AND_THROW( boost::format("invalid link name: %s")%linkstr);
}
const char* all_fields[] = {"first_step", "last_step", "max_displacement","link"};
ensure_only_members(params, all_fields, sizeof(all_fields)/sizeof(char*));
}
void CartVelCntInfo::hatch(TrajOptProb& prob) {
for (int iStep = first_step; iStep < last_step; ++iStep) {
prob.addConstraint(ConstraintPtr(new ConstraintFromFunc(
VectorOfVectorPtr(new CartVelCalculator(prob.GetRAD(), link, max_displacement)),
MatrixOfVectorPtr(new CartVelJacCalculator(prob.GetRAD(), link, max_displacement)),
concat(prob.GetVarRow(iStep), prob.GetVarRow(iStep+1)), VectorXd::Ones(0), INEQ, "CartVel")));
}
}
void JointVelCostInfo::fromJson(const Value& v) {
FAIL_IF_FALSE(v.isMember("params"));
const Value& params = v["params"];
childFromJson(params, coeffs,"coeffs");
int n_dof = gPCI->rad->GetDOF();
if (coeffs.size() == 1) coeffs = DblVec(n_dof, coeffs[0]);
else if (coeffs.size() != n_dof) {
PRINT_AND_THROW( boost::format("wrong number of coeffs. expected %i got %i")%n_dof%coeffs.size());
}
const char* all_fields[] = {"coeffs"};
ensure_only_members(params, all_fields, sizeof(all_fields)/sizeof(char*));
}
void JointVelCostInfo::hatch(TrajOptProb& prob) {
prob.addCost(CostPtr(new JointVelCost(prob.GetVars(), toVectorXd(coeffs))));
prob.getCosts().back()->setName(name);
}
void JointVelConstraintInfo::fromJson(const Value& v) {
FAIL_IF_FALSE(v.isMember("params"));
const Value& params = v["params"];
int n_steps = gPCI->basic_info.n_steps;
int n_dof = gPCI->rad->GetDOF();
childFromJson(params, vals, "vals");
childFromJson(params, first_step, "first_step", 0);
childFromJson(params, last_step, "last_step", n_steps-1);
FAIL_IF_FALSE(vals.size() == n_dof);
FAIL_IF_FALSE((first_step >= 0) && (first_step < n_steps));
FAIL_IF_FALSE((last_step >= first_step) && (last_step < n_steps));
const char* all_fields[] = {"vals", "first_step", "last_step"};
ensure_only_members(params, all_fields, sizeof(all_fields)/sizeof(char*));
}
void JointVelConstraintInfo::hatch(TrajOptProb& prob) {
for (int i = first_step; i <= last_step-1; ++i) {
for (int j=0; j < vals.size(); ++j) {
AffExpr vel = prob.GetVar(i+1,j) - prob.GetVar(i,j);
prob.addLinearConstraint(vel - vals[j], INEQ);
prob.addLinearConstraint(-vel - vals[j], INEQ);
}
}
}
void CollisionCostInfo::fromJson(const Value& v) {
FAIL_IF_FALSE(v.isMember("params"));
const Value& params = v["params"];
int n_steps = gPCI->basic_info.n_steps;
childFromJson(params, continuous, "continuous", true);
childFromJson(params, first_step, "first_step", 0);
childFromJson(params, last_step, "last_step", n_steps-1);
childFromJson(params, gap, "gap", 1);
FAIL_IF_FALSE( gap >= 0 );
FAIL_IF_FALSE((first_step >= 0) && (first_step < n_steps));
FAIL_IF_FALSE((last_step >= first_step) && (last_step < n_steps));
childFromJson(params, coeffs, "coeffs");
int n_terms = last_step - first_step + 1;
if (coeffs.size() == 1) coeffs = DblVec(n_terms, coeffs[0]);
else if (coeffs.size() != n_terms) {
PRINT_AND_THROW (boost::format("wrong size: coeffs. expected %i got %i")%n_terms%coeffs.size());
}
childFromJson(params, dist_pen,"dist_pen");
if (dist_pen.size() == 1) dist_pen = DblVec(n_terms, dist_pen[0]);
else if (dist_pen.size() != n_terms) {
PRINT_AND_THROW(boost::format("wrong size: dist_pen. expected %i got %i")%n_terms%dist_pen.size());
}
const char* all_fields[] = {"continuous", "first_step", "last_step", "gap", "coeffs", "dist_pen"};
ensure_only_members(params, all_fields, sizeof(all_fields)/sizeof(char*));
}
void CollisionCostInfo::hatch(TrajOptProb& prob) {
if (term_type == TT_COST) {
if (continuous) {
for (int i=first_step; i <= last_step - gap; ++i) {
prob.addCost(CostPtr(new CollisionCost(dist_pen[i-first_step], coeffs[i-first_step], prob.GetRAD(), prob.GetVarRow(i), prob.GetVarRow(i+gap))));
prob.getCosts().back()->setName( (boost::format("%s_%i")%name%i).str() );
}
}
else {
for (int i=first_step; i <= last_step; ++i) {
prob.addCost(CostPtr(new CollisionCost(dist_pen[i-first_step], coeffs[i-first_step], prob.GetRAD(), prob.GetVarRow(i))));
prob.getCosts().back()->setName( (boost::format("%s_%i")%name%i).str() );
}
}
}
else { // ALMOST COPIED
if (continuous) {
for (int i=first_step; i < last_step; ++i) {
prob.addIneqConstraint(ConstraintPtr(new CollisionConstraint(dist_pen[i-first_step], coeffs[i-first_step], prob.GetRAD(), prob.GetVarRow(i), prob.GetVarRow(i+1))));
prob.getIneqConstraints().back()->setName( (boost::format("%s_%i")%name%i).str() );
}
}
else {
for (int i=first_step; i <= last_step; ++i) {
prob.addIneqConstraint(ConstraintPtr(new CollisionConstraint(dist_pen[i-first_step], coeffs[i-first_step], prob.GetRAD(), prob.GetVarRow(i))));
prob.getIneqConstraints().back()->setName( (boost::format("%s_%i")%name%i).str() );
}
}
}
CollisionCheckerPtr cc = CollisionChecker::GetOrCreate(*prob.GetEnv());
cc->SetContactDistance(*std::max_element(dist_pen.begin(), dist_pen.end()) + .04);
}
void JointConstraintInfo::fromJson(const Value& v) {
FAIL_IF_FALSE(v.isMember("params"));
const Value& params = v["params"];
childFromJson(params, vals, "vals");
int n_dof = gPCI->rad->GetDOF();
if (vals.size() != n_dof) {
PRINT_AND_THROW( boost::format("wrong number of dof vals. expected %i got %i")%n_dof%vals.size());
}
childFromJson(params, timestep, "timestep", gPCI->basic_info.n_steps-1);
const char* all_fields[] = {"vals", "timestep"};
ensure_only_members(params, all_fields, sizeof(all_fields)/sizeof(char*));
}
void JointConstraintInfo::hatch(TrajOptProb& prob) {
VarVector vars = prob.GetVarRow(timestep);
int n_dof = vars.size();
for (int j=0; j < n_dof; ++j) {
prob.addLinearConstraint(exprSub(AffExpr(vars[j]), vals[j]), EQ);
}
}
}
|
//
// main.cpp
// Definite_integral_class_v2
//
// Created by wu yen sun on 2022/4/10.
//
#include <iostream>
using namespace std;
class DefInt
{
private:
double a, b;
double (*f)(double x);
public:
DefInt(double a_, double b_, double (*f_)(double x)): a(a_), b(b_), f(f_){}
double ByTrapezoid(int N);
double BySimpson(int N);
double ByMidpoint(int N);
};
double DefInt::ByTrapezoid(int N)
{
cout << "ByTrapezoid: ";
double h = (b - a) / N;
double Result = 0.5 * f(a);
for (int n = 1; n < N; n++)
Result += f(a + n * h);
Result += 0.5 * f(b);
return Result * h;
}
double DefInt::BySimpson(int N)
{
cout << "BySimpson: ";
double h = (b - a) / N;
double Result = f(a);
for (int n = 1; n < N; n++)
Result += 4 * f(a + n * h - 0.5 * h) + 2 * f(a + n * h);
Result += 4 * f(b - 0.5 * h) + f(b);
return Result * h / 6;
}
double DefInt::ByMidpoint(int N)
{
cout << "ByMidpoint: ";
double h = (b - a) / N;
double Result = 0;
for (int n = 0; n < N - 1; n++)
Result += f(a + (0.5 + n) * h);
Result = h * (Result + f(b));
return Result;
}
double f(double x) { return x * x * x - x * x + 1; }
int main()
{
double a = 1.0;
double b = 2.0;
DefInt MyInt(a, b, f);
int N = 1000;
cout << MyInt.ByTrapezoid(N) << endl;
cout << MyInt.BySimpson(N) << endl;
cout << MyInt.ByMidpoint(N) << endl;
return 0;
}
/*
ByTrapezoid: 2.41667
BySimpson: 2.41667
ByMidpoint: 2.41667
Press any key to continue . . .
*/
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/callback.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/stl_util.h"
#include "base/threading/thread.h"
#include "content/browser/byte_stream.h"
#include "content/browser/download/download_create_info.h"
#include "content/browser/download/download_file_factory.h"
#include "content/browser/download/download_item_impl.h"
#include "content/browser/download/download_item_impl_delegate.h"
#include "content/browser/download/download_request_handle.h"
#include "content/browser/download/mock_download_file.h"
#include "content/public/browser/download_destination_observer.h"
#include "content/public/browser/download_interrupt_reasons.h"
#include "content/public/browser/download_url_parameters.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/mock_download_item.h"
#include "content/public/test/test_browser_thread.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
using ::testing::_;
using ::testing::NiceMock;
using ::testing::Property;
using ::testing::Return;
using ::testing::SaveArg;
using ::testing::StrictMock;
namespace {
const int kDownloadChunkSize = 1000;
const int kDownloadSpeed = 1000;
const int kDummyDBHandle = 10;
const base::FilePath::CharType kDummyPath[] = FILE_PATH_LITERAL("/testpath");
} // namespace
namespace content {
namespace {
class MockDelegate : public DownloadItemImplDelegate {
public:
MockDelegate() : DownloadItemImplDelegate() {
SetDefaultExpectations();
}
MOCK_METHOD2(DetermineDownloadTarget, void(
DownloadItemImpl*, const DownloadTargetCallback&));
MOCK_METHOD2(ShouldCompleteDownload,
bool(DownloadItemImpl*, const base::Closure&));
MOCK_METHOD2(ShouldOpenDownload,
bool(DownloadItemImpl*, const ShouldOpenDownloadCallback&));
MOCK_METHOD1(ShouldOpenFileBasedOnExtension, bool(const base::FilePath&));
MOCK_METHOD1(CheckForFileRemoval, void(DownloadItemImpl*));
virtual void ResumeInterruptedDownload(
scoped_ptr<DownloadUrlParameters> params, uint32 id) OVERRIDE {
MockResumeInterruptedDownload(params.get(), id);
}
MOCK_METHOD2(MockResumeInterruptedDownload,
void(DownloadUrlParameters* params, uint32 id));
MOCK_CONST_METHOD0(GetBrowserContext, BrowserContext*());
MOCK_METHOD1(UpdatePersistence, void(DownloadItemImpl*));
MOCK_METHOD1(DownloadOpened, void(DownloadItemImpl*));
MOCK_METHOD1(DownloadRemoved, void(DownloadItemImpl*));
MOCK_CONST_METHOD1(AssertStateConsistent, void(DownloadItemImpl*));
void VerifyAndClearExpectations() {
::testing::Mock::VerifyAndClearExpectations(this);
SetDefaultExpectations();
}
private:
void SetDefaultExpectations() {
EXPECT_CALL(*this, AssertStateConsistent(_))
.WillRepeatedly(Return());
EXPECT_CALL(*this, ShouldOpenFileBasedOnExtension(_))
.WillRepeatedly(Return(false));
EXPECT_CALL(*this, ShouldOpenDownload(_, _))
.WillRepeatedly(Return(true));
}
};
class MockRequestHandle : public DownloadRequestHandleInterface {
public:
MOCK_CONST_METHOD0(GetWebContents, WebContents*());
MOCK_CONST_METHOD0(GetDownloadManager, DownloadManager*());
MOCK_CONST_METHOD0(PauseRequest, void());
MOCK_CONST_METHOD0(ResumeRequest, void());
MOCK_CONST_METHOD0(CancelRequest, void());
MOCK_CONST_METHOD0(DebugString, std::string());
};
// Schedules a task to invoke the RenameCompletionCallback with |new_path| on
// the UI thread. Should only be used as the action for
// MockDownloadFile::Rename as follows:
// EXPECT_CALL(download_file, Rename*(_,_))
// .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
// new_path));
ACTION_P2(ScheduleRenameCallback, interrupt_reason, new_path) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(arg1, interrupt_reason, new_path));
}
} // namespace
class DownloadItemTest : public testing::Test {
public:
class MockObserver : public DownloadItem::Observer {
public:
explicit MockObserver(DownloadItem* item)
: item_(item),
last_state_(item->GetState()),
removed_(false),
destroyed_(false),
updated_(false),
interrupt_count_(0),
resume_count_(0) {
item_->AddObserver(this);
}
virtual ~MockObserver() {
if (item_) item_->RemoveObserver(this);
}
virtual void OnDownloadRemoved(DownloadItem* download) OVERRIDE {
DVLOG(20) << " " << __FUNCTION__
<< " download = " << download->DebugString(false);
removed_ = true;
}
virtual void OnDownloadUpdated(DownloadItem* download) OVERRIDE {
DVLOG(20) << " " << __FUNCTION__
<< " download = " << download->DebugString(false);
updated_ = true;
DownloadItem::DownloadState new_state = download->GetState();
if (last_state_ == DownloadItem::IN_PROGRESS &&
new_state == DownloadItem::INTERRUPTED) {
interrupt_count_++;
}
if (last_state_ == DownloadItem::INTERRUPTED &&
new_state == DownloadItem::IN_PROGRESS) {
resume_count_++;
}
last_state_ = new_state;
}
virtual void OnDownloadOpened(DownloadItem* download) OVERRIDE {
DVLOG(20) << " " << __FUNCTION__
<< " download = " << download->DebugString(false);
}
virtual void OnDownloadDestroyed(DownloadItem* download) OVERRIDE {
DVLOG(20) << " " << __FUNCTION__
<< " download = " << download->DebugString(false);
destroyed_ = true;
item_->RemoveObserver(this);
item_ = NULL;
}
bool CheckRemoved() {
return removed_;
}
bool CheckDestroyed() {
return destroyed_;
}
bool CheckUpdated() {
bool was_updated = updated_;
updated_ = false;
return was_updated;
}
int GetInterruptCount() {
return interrupt_count_;
}
int GetResumeCount() {
return resume_count_;
}
private:
DownloadItem* item_;
DownloadItem::DownloadState last_state_;
bool removed_;
bool destroyed_;
bool updated_;
int interrupt_count_;
int resume_count_;
};
DownloadItemTest()
: ui_thread_(BrowserThread::UI, &loop_),
file_thread_(BrowserThread::FILE, &loop_),
delegate_() {
}
~DownloadItemTest() {
}
virtual void SetUp() {
}
virtual void TearDown() {
ui_thread_.DeprecatedGetThreadObject()->message_loop()->RunUntilIdle();
STLDeleteElements(&allocated_downloads_);
allocated_downloads_.clear();
}
// This class keeps ownership of the created download item; it will
// be torn down at the end of the test unless DestroyDownloadItem is
// called.
DownloadItemImpl* CreateDownloadItem() {
// Normally, the download system takes ownership of info, and is
// responsible for deleting it. In these unit tests, however, we
// don't call the function that deletes it, so we do so ourselves.
scoped_ptr<DownloadCreateInfo> info_;
info_.reset(new DownloadCreateInfo());
static uint32 next_id = DownloadItem::kInvalidId + 1;
info_->save_info = scoped_ptr<DownloadSaveInfo>(new DownloadSaveInfo());
info_->save_info->prompt_for_save_location = false;
info_->url_chain.push_back(GURL());
info_->etag = "SomethingToSatisfyResumption";
DownloadItemImpl* download =
new DownloadItemImpl(
&delegate_, next_id++, *(info_.get()), net::BoundNetLog());
allocated_downloads_.insert(download);
return download;
}
// Add DownloadFile to DownloadItem
MockDownloadFile* AddDownloadFileToDownloadItem(
DownloadItemImpl* item,
DownloadItemImplDelegate::DownloadTargetCallback *callback) {
MockDownloadFile* mock_download_file(new StrictMock<MockDownloadFile>);
scoped_ptr<DownloadFile> download_file(mock_download_file);
EXPECT_CALL(*mock_download_file, Initialize(_));
if (callback) {
// Save the callback.
EXPECT_CALL(*mock_delegate(), DetermineDownloadTarget(item, _))
.WillOnce(SaveArg<1>(callback));
} else {
// Drop it on the floor.
EXPECT_CALL(*mock_delegate(), DetermineDownloadTarget(item, _));
}
scoped_ptr<DownloadRequestHandleInterface> request_handle(
new NiceMock<MockRequestHandle>);
item->Start(download_file.Pass(), request_handle.Pass());
loop_.RunUntilIdle();
// So that we don't have a function writing to a stack variable
// lying around if the above failed.
mock_delegate()->VerifyAndClearExpectations();
EXPECT_CALL(*mock_delegate(), AssertStateConsistent(_))
.WillRepeatedly(Return());
EXPECT_CALL(*mock_delegate(), ShouldOpenFileBasedOnExtension(_))
.WillRepeatedly(Return(false));
EXPECT_CALL(*mock_delegate(), ShouldOpenDownload(_, _))
.WillRepeatedly(Return(true));
return mock_download_file;
}
// Perform the intermediate rename for |item|. The target path for the
// download will be set to kDummyPath. Returns the MockDownloadFile* that was
// added to the DownloadItem.
MockDownloadFile* DoIntermediateRename(DownloadItemImpl* item,
DownloadDangerType danger_type) {
EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
EXPECT_TRUE(item->GetTargetFilePath().empty());
DownloadItemImplDelegate::DownloadTargetCallback callback;
MockDownloadFile* download_file =
AddDownloadFileToDownloadItem(item, &callback);
base::FilePath target_path(kDummyPath);
base::FilePath intermediate_path(
target_path.InsertBeforeExtensionASCII("x"));
EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
intermediate_path));
callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
danger_type, intermediate_path);
RunAllPendingInMessageLoops();
return download_file;
}
// Cleanup a download item (specifically get rid of the DownloadFile on it).
// The item must be in the expected state.
void CleanupItem(DownloadItemImpl* item,
MockDownloadFile* download_file,
DownloadItem::DownloadState expected_state) {
EXPECT_EQ(expected_state, item->GetState());
if (expected_state == DownloadItem::IN_PROGRESS) {
EXPECT_CALL(*download_file, Cancel());
item->Cancel(true);
loop_.RunUntilIdle();
}
}
// Destroy a previously created download item.
void DestroyDownloadItem(DownloadItem* item) {
allocated_downloads_.erase(item);
delete item;
}
void RunAllPendingInMessageLoops() {
loop_.RunUntilIdle();
}
MockDelegate* mock_delegate() {
return &delegate_;
}
void OnDownloadFileAcquired(base::FilePath* return_path,
const base::FilePath& path) {
*return_path = path;
}
private:
base::MessageLoopForUI loop_;
TestBrowserThread ui_thread_; // UI thread
TestBrowserThread file_thread_; // FILE thread
StrictMock<MockDelegate> delegate_;
std::set<DownloadItem*> allocated_downloads_;
};
// Tests to ensure calls that change a DownloadItem generate an update to
// observers.
// State changing functions not tested:
// void OpenDownload();
// void ShowDownloadInShell();
// void CompleteDelayedDownload();
// set_* mutators
TEST_F(DownloadItemTest, NotificationAfterUpdate) {
DownloadItemImpl* item = CreateDownloadItem();
MockObserver observer(item);
item->DestinationUpdate(kDownloadChunkSize, kDownloadSpeed, std::string());
ASSERT_TRUE(observer.CheckUpdated());
EXPECT_EQ(kDownloadSpeed, item->CurrentSpeed());
}
TEST_F(DownloadItemTest, NotificationAfterCancel) {
DownloadItemImpl* user_cancel = CreateDownloadItem();
MockDownloadFile* download_file =
AddDownloadFileToDownloadItem(user_cancel, NULL);
EXPECT_CALL(*download_file, Cancel());
MockObserver observer1(user_cancel);
user_cancel->Cancel(true);
ASSERT_TRUE(observer1.CheckUpdated());
DownloadItemImpl* system_cancel = CreateDownloadItem();
download_file = AddDownloadFileToDownloadItem(system_cancel, NULL);
EXPECT_CALL(*download_file, Cancel());
MockObserver observer2(system_cancel);
system_cancel->Cancel(false);
ASSERT_TRUE(observer2.CheckUpdated());
}
TEST_F(DownloadItemTest, NotificationAfterComplete) {
DownloadItemImpl* item = CreateDownloadItem();
MockObserver observer(item);
item->OnAllDataSaved(DownloadItem::kEmptyFileHash);
ASSERT_TRUE(observer.CheckUpdated());
item->MarkAsComplete();
ASSERT_TRUE(observer.CheckUpdated());
}
TEST_F(DownloadItemTest, NotificationAfterDownloadedFileRemoved) {
DownloadItemImpl* item = CreateDownloadItem();
MockObserver observer(item);
item->OnDownloadedFileRemoved();
ASSERT_TRUE(observer.CheckUpdated());
}
TEST_F(DownloadItemTest, NotificationAfterInterrupted) {
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
EXPECT_CALL(*download_file, Cancel());
MockObserver observer(item);
EXPECT_CALL(*mock_delegate(), MockResumeInterruptedDownload(_,_))
.Times(0);
item->DestinationObserverAsWeakPtr()->DestinationError(
DOWNLOAD_INTERRUPT_REASON_FILE_FAILED);
ASSERT_TRUE(observer.CheckUpdated());
}
TEST_F(DownloadItemTest, NotificationAfterDestroyed) {
DownloadItemImpl* item = CreateDownloadItem();
MockObserver observer(item);
DestroyDownloadItem(item);
ASSERT_TRUE(observer.CheckDestroyed());
}
TEST_F(DownloadItemTest, ContinueAfterInterrupted) {
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableDownloadResumption);
DownloadItemImpl* item = CreateDownloadItem();
MockObserver observer(item);
DownloadItemImplDelegate::DownloadTargetCallback callback;
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
// Interrupt the download, using a continuable interrupt.
EXPECT_CALL(*download_file, FullPath())
.WillOnce(Return(base::FilePath()));
EXPECT_CALL(*download_file, Detach());
item->DestinationObserverAsWeakPtr()->DestinationError(
DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR);
ASSERT_TRUE(observer.CheckUpdated());
// Should attempt to auto-resume. Because we don't have a mock WebContents,
// ResumeInterruptedDownload() will abort early, with another interrupt,
// which will be ignored.
ASSERT_EQ(1, observer.GetInterruptCount());
ASSERT_EQ(0, observer.GetResumeCount());
RunAllPendingInMessageLoops();
CleanupItem(item, download_file, DownloadItem::INTERRUPTED);
}
// Same as above, but with a non-continuable interrupt.
TEST_F(DownloadItemTest, RestartAfterInterrupted) {
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableDownloadResumption);
DownloadItemImpl* item = CreateDownloadItem();
MockObserver observer(item);
DownloadItemImplDelegate::DownloadTargetCallback callback;
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
// Interrupt the download, using a restartable interrupt.
EXPECT_CALL(*download_file, Cancel());
item->DestinationObserverAsWeakPtr()->DestinationError(
DOWNLOAD_INTERRUPT_REASON_FILE_FAILED);
ASSERT_TRUE(observer.CheckUpdated());
// Should not try to auto-resume.
ASSERT_EQ(1, observer.GetInterruptCount());
ASSERT_EQ(0, observer.GetResumeCount());
RunAllPendingInMessageLoops();
CleanupItem(item, download_file, DownloadItem::INTERRUPTED);
}
TEST_F(DownloadItemTest, LimitRestartsAfterInterrupted) {
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableDownloadResumption);
DownloadItemImpl* item = CreateDownloadItem();
base::WeakPtr<DownloadDestinationObserver> as_observer(
item->DestinationObserverAsWeakPtr());
MockObserver observer(item);
MockDownloadFile* mock_download_file(NULL);
scoped_ptr<DownloadFile> download_file;
MockRequestHandle* mock_request_handle(NULL);
scoped_ptr<DownloadRequestHandleInterface> request_handle;
DownloadItemImplDelegate::DownloadTargetCallback callback;
EXPECT_CALL(*mock_delegate(), DetermineDownloadTarget(item, _))
.WillRepeatedly(SaveArg<1>(&callback));
for (int i = 0; i < (DownloadItemImpl::kMaxAutoResumeAttempts + 1); ++i) {
DVLOG(20) << "Loop iteration " << i;
mock_download_file = new NiceMock<MockDownloadFile>;
download_file.reset(mock_download_file);
mock_request_handle = new NiceMock<MockRequestHandle>;
request_handle.reset(mock_request_handle);
ON_CALL(*mock_download_file, FullPath())
.WillByDefault(Return(base::FilePath()));
// It's too complicated to set up a WebContents instance that would cause
// the MockDownloadItemDelegate's ResumeInterruptedDownload() function
// to be callled, so we simply verify that GetWebContents() is called.
if (i < (DownloadItemImpl::kMaxAutoResumeAttempts - 1)) {
EXPECT_CALL(*mock_request_handle, GetWebContents())
.WillRepeatedly(Return(static_cast<WebContents*>(NULL)));
}
// Copied key parts of DoIntermediateRename & AddDownloadFileToDownloadItem
// to allow for holding onto the request handle.
item->Start(download_file.Pass(), request_handle.Pass());
RunAllPendingInMessageLoops();
if (i == 0) {
// Target determination is only done the first time through.
base::FilePath target_path(kDummyPath);
base::FilePath intermediate_path(
target_path.InsertBeforeExtensionASCII("x"));
EXPECT_CALL(*mock_download_file, RenameAndUniquify(intermediate_path, _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
intermediate_path));
callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path);
RunAllPendingInMessageLoops();
}
ASSERT_EQ(i, observer.GetResumeCount());
// Use a continuable interrupt.
item->DestinationObserverAsWeakPtr()->DestinationError(
DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR);
ASSERT_EQ(i + 1, observer.GetInterruptCount());
::testing::Mock::VerifyAndClearExpectations(mock_download_file);
}
CleanupItem(item, mock_download_file, DownloadItem::INTERRUPTED);
}
TEST_F(DownloadItemTest, NotificationAfterRemove) {
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file = AddDownloadFileToDownloadItem(item, NULL);
EXPECT_CALL(*download_file, Cancel());
EXPECT_CALL(*mock_delegate(), DownloadRemoved(_));
MockObserver observer(item);
item->Remove();
ASSERT_TRUE(observer.CheckUpdated());
ASSERT_TRUE(observer.CheckRemoved());
}
TEST_F(DownloadItemTest, NotificationAfterOnContentCheckCompleted) {
// Setting to NOT_DANGEROUS does not trigger a notification.
DownloadItemImpl* safe_item = CreateDownloadItem();
MockObserver safe_observer(safe_item);
safe_item->OnAllDataSaved(std::string());
EXPECT_TRUE(safe_observer.CheckUpdated());
safe_item->OnContentCheckCompleted(DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
EXPECT_TRUE(safe_observer.CheckUpdated());
// Setting to unsafe url or unsafe file should trigger a notification.
DownloadItemImpl* unsafeurl_item =
CreateDownloadItem();
MockObserver unsafeurl_observer(unsafeurl_item);
unsafeurl_item->OnAllDataSaved(std::string());
EXPECT_TRUE(unsafeurl_observer.CheckUpdated());
unsafeurl_item->OnContentCheckCompleted(DOWNLOAD_DANGER_TYPE_DANGEROUS_URL);
EXPECT_TRUE(unsafeurl_observer.CheckUpdated());
unsafeurl_item->ValidateDangerousDownload();
EXPECT_TRUE(unsafeurl_observer.CheckUpdated());
DownloadItemImpl* unsafefile_item =
CreateDownloadItem();
MockObserver unsafefile_observer(unsafefile_item);
unsafefile_item->OnAllDataSaved(std::string());
EXPECT_TRUE(unsafefile_observer.CheckUpdated());
unsafefile_item->OnContentCheckCompleted(DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE);
EXPECT_TRUE(unsafefile_observer.CheckUpdated());
unsafefile_item->ValidateDangerousDownload();
EXPECT_TRUE(unsafefile_observer.CheckUpdated());
}
// DownloadItemImpl::OnDownloadTargetDetermined will schedule a task to run
// DownloadFile::Rename(). Once the rename
// completes, DownloadItemImpl receives a notification with the new file
// name. Check that observers are updated when the new filename is available and
// not before.
TEST_F(DownloadItemTest, NotificationAfterOnDownloadTargetDetermined) {
DownloadItemImpl* item = CreateDownloadItem();
DownloadItemImplDelegate::DownloadTargetCallback callback;
MockDownloadFile* download_file =
AddDownloadFileToDownloadItem(item, &callback);
MockObserver observer(item);
base::FilePath target_path(kDummyPath);
base::FilePath intermediate_path(target_path.InsertBeforeExtensionASCII("x"));
base::FilePath new_intermediate_path(
target_path.InsertBeforeExtensionASCII("y"));
EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
new_intermediate_path));
// Currently, a notification would be generated if the danger type is anything
// other than NOT_DANGEROUS.
callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path);
EXPECT_FALSE(observer.CheckUpdated());
RunAllPendingInMessageLoops();
EXPECT_TRUE(observer.CheckUpdated());
EXPECT_EQ(new_intermediate_path, item->GetFullPath());
CleanupItem(item, download_file, DownloadItem::IN_PROGRESS);
}
TEST_F(DownloadItemTest, NotificationAfterTogglePause) {
DownloadItemImpl* item = CreateDownloadItem();
MockObserver observer(item);
MockDownloadFile* mock_download_file(new MockDownloadFile);
scoped_ptr<DownloadFile> download_file(mock_download_file);
scoped_ptr<DownloadRequestHandleInterface> request_handle(
new NiceMock<MockRequestHandle>);
EXPECT_CALL(*mock_download_file, Initialize(_));
EXPECT_CALL(*mock_delegate(), DetermineDownloadTarget(_, _));
item->Start(download_file.Pass(), request_handle.Pass());
item->Pause();
ASSERT_TRUE(observer.CheckUpdated());
ASSERT_TRUE(item->IsPaused());
item->Resume();
ASSERT_TRUE(observer.CheckUpdated());
RunAllPendingInMessageLoops();
CleanupItem(item, mock_download_file, DownloadItem::IN_PROGRESS);
}
TEST_F(DownloadItemTest, DisplayName) {
DownloadItemImpl* item = CreateDownloadItem();
DownloadItemImplDelegate::DownloadTargetCallback callback;
MockDownloadFile* download_file =
AddDownloadFileToDownloadItem(item, &callback);
base::FilePath target_path(base::FilePath(kDummyPath).AppendASCII("foo.bar"));
base::FilePath intermediate_path(target_path.InsertBeforeExtensionASCII("x"));
EXPECT_EQ(FILE_PATH_LITERAL(""),
item->GetFileNameToReportUser().value());
EXPECT_CALL(*download_file, RenameAndUniquify(_, _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
intermediate_path));
callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path);
RunAllPendingInMessageLoops();
EXPECT_EQ(FILE_PATH_LITERAL("foo.bar"),
item->GetFileNameToReportUser().value());
item->SetDisplayName(base::FilePath(FILE_PATH_LITERAL("new.name")));
EXPECT_EQ(FILE_PATH_LITERAL("new.name"),
item->GetFileNameToReportUser().value());
CleanupItem(item, download_file, DownloadItem::IN_PROGRESS);
}
// Test to make sure that Start method calls DF initialize properly.
TEST_F(DownloadItemTest, Start) {
MockDownloadFile* mock_download_file(new MockDownloadFile);
scoped_ptr<DownloadFile> download_file(mock_download_file);
DownloadItemImpl* item = CreateDownloadItem();
EXPECT_CALL(*mock_download_file, Initialize(_));
scoped_ptr<DownloadRequestHandleInterface> request_handle(
new NiceMock<MockRequestHandle>);
EXPECT_CALL(*mock_delegate(), DetermineDownloadTarget(item, _));
item->Start(download_file.Pass(), request_handle.Pass());
RunAllPendingInMessageLoops();
CleanupItem(item, mock_download_file, DownloadItem::IN_PROGRESS);
}
// Test that the delegate is invoked after the download file is renamed.
TEST_F(DownloadItemTest, CallbackAfterRename) {
DownloadItemImpl* item = CreateDownloadItem();
DownloadItemImplDelegate::DownloadTargetCallback callback;
MockDownloadFile* download_file =
AddDownloadFileToDownloadItem(item, &callback);
base::FilePath final_path(base::FilePath(kDummyPath).AppendASCII("foo.bar"));
base::FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x"));
base::FilePath new_intermediate_path(
final_path.InsertBeforeExtensionASCII("y"));
EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
new_intermediate_path));
callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path);
RunAllPendingInMessageLoops();
// All the callbacks should have happened by now.
::testing::Mock::VerifyAndClearExpectations(download_file);
mock_delegate()->VerifyAndClearExpectations();
EXPECT_CALL(*mock_delegate(), ShouldCompleteDownload(item, _))
.WillOnce(Return(true));
EXPECT_CALL(*download_file, RenameAndAnnotate(final_path, _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
final_path));
EXPECT_CALL(*download_file, FullPath())
.WillOnce(Return(base::FilePath()));
EXPECT_CALL(*download_file, Detach());
item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string());
RunAllPendingInMessageLoops();
::testing::Mock::VerifyAndClearExpectations(download_file);
mock_delegate()->VerifyAndClearExpectations();
}
// Test that the delegate is invoked after the download file is renamed and the
// download item is in an interrupted state.
TEST_F(DownloadItemTest, CallbackAfterInterruptedRename) {
DownloadItemImpl* item = CreateDownloadItem();
DownloadItemImplDelegate::DownloadTargetCallback callback;
MockDownloadFile* download_file =
AddDownloadFileToDownloadItem(item, &callback);
base::FilePath final_path(base::FilePath(kDummyPath).AppendASCII("foo.bar"));
base::FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x"));
base::FilePath new_intermediate_path(
final_path.InsertBeforeExtensionASCII("y"));
EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_FILE_FAILED,
new_intermediate_path));
EXPECT_CALL(*download_file, Cancel())
.Times(1);
callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path);
RunAllPendingInMessageLoops();
// All the callbacks should have happened by now.
::testing::Mock::VerifyAndClearExpectations(download_file);
mock_delegate()->VerifyAndClearExpectations();
}
TEST_F(DownloadItemTest, Interrupted) {
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
const DownloadInterruptReason reason(
DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED);
// Confirm interrupt sets state properly.
EXPECT_CALL(*download_file, Cancel());
item->DestinationObserverAsWeakPtr()->DestinationError(reason);
RunAllPendingInMessageLoops();
EXPECT_EQ(DownloadItem::INTERRUPTED, item->GetState());
EXPECT_EQ(reason, item->GetLastReason());
// Cancel should kill it.
item->Cancel(true);
EXPECT_EQ(DownloadItem::CANCELLED, item->GetState());
EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_USER_CANCELED, item->GetLastReason());
}
// Destination errors that occur before the intermediate rename shouldn't cause
// the download to be marked as interrupted until after the intermediate rename.
TEST_F(DownloadItemTest, InterruptedBeforeIntermediateRename_Restart) {
DownloadItemImpl* item = CreateDownloadItem();
DownloadItemImplDelegate::DownloadTargetCallback callback;
MockDownloadFile* download_file =
AddDownloadFileToDownloadItem(item, &callback);
item->DestinationObserverAsWeakPtr()->DestinationError(
DOWNLOAD_INTERRUPT_REASON_FILE_FAILED);
ASSERT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
base::FilePath final_path(base::FilePath(kDummyPath).AppendASCII("foo.bar"));
base::FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x"));
base::FilePath new_intermediate_path(
final_path.InsertBeforeExtensionASCII("y"));
EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
new_intermediate_path));
EXPECT_CALL(*download_file, Cancel())
.Times(1);
callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path);
RunAllPendingInMessageLoops();
// All the callbacks should have happened by now.
::testing::Mock::VerifyAndClearExpectations(download_file);
mock_delegate()->VerifyAndClearExpectations();
EXPECT_EQ(DownloadItem::INTERRUPTED, item->GetState());
EXPECT_TRUE(item->GetFullPath().empty());
EXPECT_EQ(final_path, item->GetTargetFilePath());
}
// As above. But if the download can be resumed by continuing, then the
// intermediate path should be retained when the download is interrupted after
// the intermediate rename succeeds.
TEST_F(DownloadItemTest, InterruptedBeforeIntermediateRename_Continue) {
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableDownloadResumption);
DownloadItemImpl* item = CreateDownloadItem();
DownloadItemImplDelegate::DownloadTargetCallback callback;
MockDownloadFile* download_file =
AddDownloadFileToDownloadItem(item, &callback);
item->DestinationObserverAsWeakPtr()->DestinationError(
DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED);
ASSERT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
base::FilePath final_path(base::FilePath(kDummyPath).AppendASCII("foo.bar"));
base::FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x"));
base::FilePath new_intermediate_path(
final_path.InsertBeforeExtensionASCII("y"));
EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
new_intermediate_path));
EXPECT_CALL(*download_file, FullPath())
.WillOnce(Return(base::FilePath(new_intermediate_path)));
EXPECT_CALL(*download_file, Detach());
callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path);
RunAllPendingInMessageLoops();
// All the callbacks should have happened by now.
::testing::Mock::VerifyAndClearExpectations(download_file);
mock_delegate()->VerifyAndClearExpectations();
EXPECT_EQ(DownloadItem::INTERRUPTED, item->GetState());
EXPECT_EQ(new_intermediate_path, item->GetFullPath());
EXPECT_EQ(final_path, item->GetTargetFilePath());
}
// As above. If the intermediate rename fails, then the interrupt reason should
// be set to the destination error and the intermediate path should be empty.
TEST_F(DownloadItemTest, InterruptedBeforeIntermediateRename_Failed) {
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableDownloadResumption);
DownloadItemImpl* item = CreateDownloadItem();
DownloadItemImplDelegate::DownloadTargetCallback callback;
MockDownloadFile* download_file =
AddDownloadFileToDownloadItem(item, &callback);
item->DestinationObserverAsWeakPtr()->DestinationError(
DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED);
ASSERT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
base::FilePath final_path(base::FilePath(kDummyPath).AppendASCII("foo.bar"));
base::FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x"));
base::FilePath new_intermediate_path(
final_path.InsertBeforeExtensionASCII("y"));
EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_FILE_FAILED,
new_intermediate_path));
EXPECT_CALL(*download_file, Cancel())
.Times(1);
callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path);
RunAllPendingInMessageLoops();
// All the callbacks should have happened by now.
::testing::Mock::VerifyAndClearExpectations(download_file);
mock_delegate()->VerifyAndClearExpectations();
EXPECT_EQ(DownloadItem::INTERRUPTED, item->GetState());
EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, item->GetLastReason());
EXPECT_TRUE(item->GetFullPath().empty());
EXPECT_EQ(final_path, item->GetTargetFilePath());
}
TEST_F(DownloadItemTest, Canceled) {
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file = AddDownloadFileToDownloadItem(item, NULL);
// Confirm cancel sets state properly.
EXPECT_CALL(*download_file, Cancel());
item->Cancel(true);
EXPECT_EQ(DownloadItem::CANCELLED, item->GetState());
}
TEST_F(DownloadItemTest, FileRemoved) {
DownloadItemImpl* item = CreateDownloadItem();
EXPECT_FALSE(item->GetFileExternallyRemoved());
item->OnDownloadedFileRemoved();
EXPECT_TRUE(item->GetFileExternallyRemoved());
}
TEST_F(DownloadItemTest, DestinationUpdate) {
DownloadItemImpl* item = CreateDownloadItem();
base::WeakPtr<DownloadDestinationObserver> as_observer(
item->DestinationObserverAsWeakPtr());
MockObserver observer(item);
EXPECT_EQ(0l, item->CurrentSpeed());
EXPECT_EQ("", item->GetHashState());
EXPECT_EQ(0l, item->GetReceivedBytes());
EXPECT_EQ(0l, item->GetTotalBytes());
EXPECT_FALSE(observer.CheckUpdated());
item->SetTotalBytes(100l);
EXPECT_EQ(100l, item->GetTotalBytes());
as_observer->DestinationUpdate(10, 20, "deadbeef");
EXPECT_EQ(20l, item->CurrentSpeed());
EXPECT_EQ("deadbeef", item->GetHashState());
EXPECT_EQ(10l, item->GetReceivedBytes());
EXPECT_EQ(100l, item->GetTotalBytes());
EXPECT_TRUE(observer.CheckUpdated());
as_observer->DestinationUpdate(200, 20, "livebeef");
EXPECT_EQ(20l, item->CurrentSpeed());
EXPECT_EQ("livebeef", item->GetHashState());
EXPECT_EQ(200l, item->GetReceivedBytes());
EXPECT_EQ(0l, item->GetTotalBytes());
EXPECT_TRUE(observer.CheckUpdated());
}
TEST_F(DownloadItemTest, DestinationError) {
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
base::WeakPtr<DownloadDestinationObserver> as_observer(
item->DestinationObserverAsWeakPtr());
MockObserver observer(item);
EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, item->GetLastReason());
EXPECT_FALSE(observer.CheckUpdated());
EXPECT_CALL(*download_file, Cancel());
as_observer->DestinationError(
DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED);
mock_delegate()->VerifyAndClearExpectations();
EXPECT_TRUE(observer.CheckUpdated());
EXPECT_EQ(DownloadItem::INTERRUPTED, item->GetState());
EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED,
item->GetLastReason());
}
TEST_F(DownloadItemTest, DestinationCompleted) {
DownloadItemImpl* item = CreateDownloadItem();
base::WeakPtr<DownloadDestinationObserver> as_observer(
item->DestinationObserverAsWeakPtr());
MockObserver observer(item);
EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
EXPECT_EQ("", item->GetHash());
EXPECT_EQ("", item->GetHashState());
EXPECT_FALSE(item->AllDataSaved());
EXPECT_FALSE(observer.CheckUpdated());
as_observer->DestinationUpdate(10, 20, "deadbeef");
EXPECT_TRUE(observer.CheckUpdated());
EXPECT_FALSE(observer.CheckUpdated()); // Confirm reset.
EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
EXPECT_EQ("", item->GetHash());
EXPECT_EQ("deadbeef", item->GetHashState());
EXPECT_FALSE(item->AllDataSaved());
as_observer->DestinationCompleted("livebeef");
mock_delegate()->VerifyAndClearExpectations();
EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
EXPECT_TRUE(observer.CheckUpdated());
EXPECT_EQ("livebeef", item->GetHash());
EXPECT_EQ("", item->GetHashState());
EXPECT_TRUE(item->AllDataSaved());
}
TEST_F(DownloadItemTest, EnabledActionsForNormalDownload) {
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
// InProgress
ASSERT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
ASSERT_FALSE(item->GetTargetFilePath().empty());
EXPECT_TRUE(item->CanShowInFolder());
EXPECT_TRUE(item->CanOpenDownload());
// Complete
EXPECT_CALL(*download_file, RenameAndAnnotate(_, _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
base::FilePath(kDummyPath)));
EXPECT_CALL(*mock_delegate(), ShouldCompleteDownload(item, _))
.WillOnce(Return(true));
EXPECT_CALL(*download_file, FullPath())
.WillOnce(Return(base::FilePath()));
EXPECT_CALL(*download_file, Detach());
item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string());
RunAllPendingInMessageLoops();
ASSERT_EQ(DownloadItem::COMPLETE, item->GetState());
EXPECT_TRUE(item->CanShowInFolder());
EXPECT_TRUE(item->CanOpenDownload());
}
TEST_F(DownloadItemTest, EnabledActionsForTemporaryDownload) {
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
item->SetIsTemporary(true);
// InProgress Temporary
ASSERT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
ASSERT_FALSE(item->GetTargetFilePath().empty());
ASSERT_TRUE(item->IsTemporary());
EXPECT_FALSE(item->CanShowInFolder());
EXPECT_FALSE(item->CanOpenDownload());
// Complete Temporary
EXPECT_CALL(*mock_delegate(), ShouldCompleteDownload(item, _))
.WillOnce(Return(true));
EXPECT_CALL(*download_file, RenameAndAnnotate(_, _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
base::FilePath(kDummyPath)));
EXPECT_CALL(*download_file, FullPath())
.WillOnce(Return(base::FilePath()));
EXPECT_CALL(*download_file, Detach());
item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string());
RunAllPendingInMessageLoops();
ASSERT_EQ(DownloadItem::COMPLETE, item->GetState());
EXPECT_FALSE(item->CanShowInFolder());
EXPECT_FALSE(item->CanOpenDownload());
}
TEST_F(DownloadItemTest, EnabledActionsForInterruptedDownload) {
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
EXPECT_CALL(*download_file, Cancel());
item->DestinationObserverAsWeakPtr()->DestinationError(
DOWNLOAD_INTERRUPT_REASON_FILE_FAILED);
RunAllPendingInMessageLoops();
ASSERT_EQ(DownloadItem::INTERRUPTED, item->GetState());
ASSERT_FALSE(item->GetTargetFilePath().empty());
EXPECT_FALSE(item->CanShowInFolder());
EXPECT_FALSE(item->CanOpenDownload());
}
TEST_F(DownloadItemTest, EnabledActionsForCancelledDownload) {
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
EXPECT_CALL(*download_file, Cancel());
item->Cancel(true);
RunAllPendingInMessageLoops();
ASSERT_EQ(DownloadItem::CANCELLED, item->GetState());
EXPECT_FALSE(item->CanShowInFolder());
EXPECT_FALSE(item->CanOpenDownload());
}
// Test various aspects of the delegate completion blocker.
// Just allowing completion.
TEST_F(DownloadItemTest, CompleteDelegate_ReturnTrue) {
// Test to confirm that if we have a callback that returns true,
// we complete immediately.
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
// Drive the delegate interaction.
EXPECT_CALL(*mock_delegate(), ShouldCompleteDownload(item, _))
.WillOnce(Return(true));
item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string());
EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
EXPECT_FALSE(item->IsDangerous());
// Make sure the download can complete.
EXPECT_CALL(*download_file, RenameAndAnnotate(base::FilePath(kDummyPath), _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
base::FilePath(kDummyPath)));
EXPECT_CALL(*mock_delegate(), ShouldOpenDownload(item, _))
.WillOnce(Return(true));
EXPECT_CALL(*download_file, FullPath())
.WillOnce(Return(base::FilePath()));
EXPECT_CALL(*download_file, Detach());
RunAllPendingInMessageLoops();
EXPECT_EQ(DownloadItem::COMPLETE, item->GetState());
}
// Just delaying completion.
TEST_F(DownloadItemTest, CompleteDelegate_BlockOnce) {
// Test to confirm that if we have a callback that returns true,
// we complete immediately.
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
// Drive the delegate interaction.
base::Closure delegate_callback;
base::Closure copy_delegate_callback;
EXPECT_CALL(*mock_delegate(), ShouldCompleteDownload(item, _))
.WillOnce(DoAll(SaveArg<1>(&delegate_callback),
Return(false)))
.WillOnce(Return(true));
item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string());
ASSERT_FALSE(delegate_callback.is_null());
copy_delegate_callback = delegate_callback;
delegate_callback.Reset();
EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
copy_delegate_callback.Run();
ASSERT_TRUE(delegate_callback.is_null());
EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
EXPECT_FALSE(item->IsDangerous());
// Make sure the download can complete.
EXPECT_CALL(*download_file, RenameAndAnnotate(base::FilePath(kDummyPath), _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
base::FilePath(kDummyPath)));
EXPECT_CALL(*mock_delegate(), ShouldOpenDownload(item, _))
.WillOnce(Return(true));
EXPECT_CALL(*download_file, FullPath())
.WillOnce(Return(base::FilePath()));
EXPECT_CALL(*download_file, Detach());
RunAllPendingInMessageLoops();
EXPECT_EQ(DownloadItem::COMPLETE, item->GetState());
}
// Delay and set danger.
TEST_F(DownloadItemTest, CompleteDelegate_SetDanger) {
// Test to confirm that if we have a callback that returns true,
// we complete immediately.
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
// Drive the delegate interaction.
base::Closure delegate_callback;
base::Closure copy_delegate_callback;
EXPECT_CALL(*mock_delegate(), ShouldCompleteDownload(item, _))
.WillOnce(DoAll(SaveArg<1>(&delegate_callback),
Return(false)))
.WillOnce(Return(true));
item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string());
ASSERT_FALSE(delegate_callback.is_null());
copy_delegate_callback = delegate_callback;
delegate_callback.Reset();
EXPECT_FALSE(item->IsDangerous());
item->OnContentCheckCompleted(
content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE);
EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
copy_delegate_callback.Run();
ASSERT_TRUE(delegate_callback.is_null());
EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
EXPECT_TRUE(item->IsDangerous());
// Make sure the download doesn't complete until we've validated it.
EXPECT_CALL(*download_file, RenameAndAnnotate(base::FilePath(kDummyPath), _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
base::FilePath(kDummyPath)));
EXPECT_CALL(*mock_delegate(), ShouldOpenDownload(item, _))
.WillOnce(Return(true));
EXPECT_CALL(*download_file, FullPath())
.WillOnce(Return(base::FilePath()));
EXPECT_CALL(*download_file, Detach());
RunAllPendingInMessageLoops();
EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
EXPECT_TRUE(item->IsDangerous());
item->ValidateDangerousDownload();
EXPECT_EQ(DOWNLOAD_DANGER_TYPE_USER_VALIDATED, item->GetDangerType());
RunAllPendingInMessageLoops();
EXPECT_EQ(DownloadItem::COMPLETE, item->GetState());
}
// Just delaying completion twice.
TEST_F(DownloadItemTest, CompleteDelegate_BlockTwice) {
// Test to confirm that if we have a callback that returns true,
// we complete immediately.
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
// Drive the delegate interaction.
base::Closure delegate_callback;
base::Closure copy_delegate_callback;
EXPECT_CALL(*mock_delegate(), ShouldCompleteDownload(item, _))
.WillOnce(DoAll(SaveArg<1>(&delegate_callback),
Return(false)))
.WillOnce(DoAll(SaveArg<1>(&delegate_callback),
Return(false)))
.WillOnce(Return(true));
item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string());
ASSERT_FALSE(delegate_callback.is_null());
copy_delegate_callback = delegate_callback;
delegate_callback.Reset();
EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
copy_delegate_callback.Run();
ASSERT_FALSE(delegate_callback.is_null());
copy_delegate_callback = delegate_callback;
delegate_callback.Reset();
EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
copy_delegate_callback.Run();
ASSERT_TRUE(delegate_callback.is_null());
EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState());
EXPECT_FALSE(item->IsDangerous());
// Make sure the download can complete.
EXPECT_CALL(*download_file, RenameAndAnnotate(base::FilePath(kDummyPath), _))
.WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
base::FilePath(kDummyPath)));
EXPECT_CALL(*mock_delegate(), ShouldOpenDownload(item, _))
.WillOnce(Return(true));
EXPECT_CALL(*download_file, FullPath())
.WillOnce(Return(base::FilePath()));
EXPECT_CALL(*download_file, Detach());
RunAllPendingInMessageLoops();
EXPECT_EQ(DownloadItem::COMPLETE, item->GetState());
}
TEST_F(DownloadItemTest, StealDangerousDownload) {
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE);
ASSERT_TRUE(item->IsDangerous());
base::FilePath full_path(FILE_PATH_LITERAL("foo.txt"));
base::FilePath returned_path;
EXPECT_CALL(*download_file, FullPath())
.WillOnce(Return(full_path));
EXPECT_CALL(*download_file, Detach());
EXPECT_CALL(*mock_delegate(), DownloadRemoved(_));
base::WeakPtrFactory<DownloadItemTest> weak_ptr_factory(this);
item->StealDangerousDownload(
base::Bind(&DownloadItemTest::OnDownloadFileAcquired,
weak_ptr_factory.GetWeakPtr(),
base::Unretained(&returned_path)));
RunAllPendingInMessageLoops();
EXPECT_EQ(full_path, returned_path);
}
TEST_F(DownloadItemTest, StealInterruptedDangerousDownload) {
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableDownloadResumption);
base::FilePath returned_path;
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE);
base::FilePath full_path = item->GetFullPath();
EXPECT_FALSE(full_path.empty());
EXPECT_CALL(*download_file, FullPath())
.WillOnce(Return(full_path));
EXPECT_CALL(*download_file, Detach());
item->DestinationObserverAsWeakPtr()->DestinationError(
DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED);
ASSERT_TRUE(item->IsDangerous());
EXPECT_CALL(*mock_delegate(), DownloadRemoved(_));
base::WeakPtrFactory<DownloadItemTest> weak_ptr_factory(this);
item->StealDangerousDownload(
base::Bind(&DownloadItemTest::OnDownloadFileAcquired,
weak_ptr_factory.GetWeakPtr(),
base::Unretained(&returned_path)));
RunAllPendingInMessageLoops();
EXPECT_EQ(full_path, returned_path);
}
TEST_F(DownloadItemTest, StealInterruptedNonResumableDangerousDownload) {
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableDownloadResumption);
base::FilePath returned_path;
DownloadItemImpl* item = CreateDownloadItem();
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE);
EXPECT_CALL(*download_file, Cancel());
item->DestinationObserverAsWeakPtr()->DestinationError(
DOWNLOAD_INTERRUPT_REASON_FILE_FAILED);
ASSERT_TRUE(item->IsDangerous());
EXPECT_CALL(*mock_delegate(), DownloadRemoved(_));
base::WeakPtrFactory<DownloadItemTest> weak_ptr_factory(this);
item->StealDangerousDownload(
base::Bind(&DownloadItemTest::OnDownloadFileAcquired,
weak_ptr_factory.GetWeakPtr(),
base::Unretained(&returned_path)));
RunAllPendingInMessageLoops();
EXPECT_TRUE(returned_path.empty());
}
TEST(MockDownloadItem, Compiles) {
MockDownloadItem mock_item;
}
} // namespace content
|
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2018 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <amount.h>
#include <chain.h>
#include <chainparams.h>
#include <consensus/consensus.h>
#include <consensus/params.h>
#include <consensus/validation.h>
#include <core_io.h>
#include <key_io.h>
#include <miner.h>
#include <net.h>
#include <policy/fees.h>
#include <pow.h>
#include <rpc/blockchain.h>
#include <rpc/mining.h>
#include <rpc/server.h>
#include <rpc/util.h>
#include <shutdown.h>
#include <txmempool.h>
#include <util/strencodings.h>
#include <util/system.h>
#include <validation.h>
#include <validationinterface.h>
#include <versionbitsinfo.h>
#include <warnings.h>
#include <memory>
#include <stdint.h>
/**
* Return average network hashes per second based on the last 'lookup' blocks,
* or from the last difficulty change if 'lookup' is nonpositive.
* If 'height' is nonnegative, compute the estimate at the time when a given block was found.
*/
static UniValue GetNetworkHashPS(int lookup, int height) {
CBlockIndex *pb = chainActive.Tip();
if (height >= 0 && height < chainActive.Height())
pb = chainActive[height];
if (pb == nullptr || !pb->nHeight)
return 0;
// If lookup is -1, then use blocks since last difficulty change.
if (lookup <= 0)
lookup = pb->nHeight % Params().GetConsensus().DifficultyAdjustmentInterval() + 1;
// If lookup is larger than chain, then set it to chain length.
if (lookup > pb->nHeight)
lookup = pb->nHeight;
CBlockIndex *pb0 = pb;
int64_t minTime = pb0->GetBlockTime();
int64_t maxTime = minTime;
for (int i = 0; i < lookup; i++) {
pb0 = pb0->pprev;
int64_t time = pb0->GetBlockTime();
minTime = std::min(time, minTime);
maxTime = std::max(time, maxTime);
}
// In case there's a situation where minTime == maxTime, we don't want a divide by zero exception.
if (minTime == maxTime)
return 0;
arith_uint256 workDiff = pb->nChainWork - pb0->nChainWork;
int64_t timeDiff = maxTime - minTime;
return workDiff.getdouble() / timeDiff;
}
static UniValue getnetworkhashps(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 2)
throw std::runtime_error(
RPCHelpMan{"getnetworkhashps",
"\nReturns the estimated network hashes per second based on the last n blocks.\n"
"Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n"
"Pass in [height] to estimate the network speed at the time when a certain block was found.\n",
{
{"nblocks", RPCArg::Type::NUM, /* default */ "120", "The number of blocks, or -1 for blocks since last difficulty change."},
{"height", RPCArg::Type::NUM, /* default */ "-1", "To estimate at the time of the given height."},
},
RPCResult{
"x (numeric) Hashes per second estimated\n"
},
RPCExamples{
HelpExampleCli("getnetworkhashps", "")
+ HelpExampleRpc("getnetworkhashps", "")
},
}.ToString());
LOCK(cs_main);
return GetNetworkHashPS(!request.params[0].isNull() ? request.params[0].get_int() : 120, !request.params[1].isNull() ? request.params[1].get_int() : -1);
}
UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript)
{
static const int nInnerLoopCount = 0x10000;
int nHeightEnd = 0;
int nHeight = 0;
{ // Don't keep cs_main locked
LOCK(cs_main);
nHeight = chainActive.Height();
nHeightEnd = nHeight+nGenerate;
}
unsigned int nExtraNonce = 0;
UniValue blockHashes(UniValue::VARR);
while (nHeight < nHeightEnd && !ShutdownRequested())
{
std::unique_ptr<CBlockTemplate> pblocktemplate(BlockAssembler(Params()).CreateNewBlock(coinbaseScript->reserveScript));
if (!pblocktemplate.get())
throw JSONRPCError(RPC_INTERNAL_ERROR, "Couldn't create new block");
CBlock *pblock = &pblocktemplate->block;
{
LOCK(cs_main);
IncrementExtraNonce(pblock, chainActive.Tip(), nExtraNonce);
}
while (nMaxTries > 0 && pblock->nNonce < nInnerLoopCount && !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, Params().GetConsensus())) {
++pblock->nNonce;
--nMaxTries;
}
if (nMaxTries == 0) {
break;
}
if (pblock->nNonce == nInnerLoopCount) {
continue;
}
std::shared_ptr<const CBlock> shared_pblock = std::make_shared<const CBlock>(*pblock);
if (!ProcessNewBlock(Params(), shared_pblock, true, nullptr))
throw JSONRPCError(RPC_INTERNAL_ERROR, "ProcessNewBlock, block not accepted");
++nHeight;
blockHashes.push_back(pblock->GetHash().GetHex());
//mark script as important because it was used at least for one coinbase output if the script came from the wallet
if (keepScript)
{
coinbaseScript->KeepScript();
}
}
return blockHashes;
}
static UniValue generatetoaddress(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
throw std::runtime_error(
RPCHelpMan{"generatetoaddress",
"\nMine blocks immediately to a specified address (before the RPC call returns)\n",
{
{"nblocks", RPCArg::Type::NUM, RPCArg::Optional::NO, "How many blocks are generated immediately."},
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The address to send the newly generated eloncoin to."},
{"maxtries", RPCArg::Type::NUM, /* default */ "1000000", "How many iterations to try."},
},
RPCResult{
"[ blockhashes ] (array) hashes of blocks generated\n"
},
RPCExamples{
"\nGenerate 11 blocks to myaddress\n"
+ HelpExampleCli("generatetoaddress", "11 \"myaddress\"")
+ "If you are running the eloncoin core wallet, you can get a new address to send the newly generated eloncoin to with:\n"
+ HelpExampleCli("getnewaddress", "")
},
}.ToString());
int nGenerate = request.params[0].get_int();
uint64_t nMaxTries = 1000000;
if (!request.params[2].isNull()) {
nMaxTries = request.params[2].get_int();
}
CTxDestination destination = DecodeDestination(request.params[1].get_str());
if (!IsValidDestination(destination)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Invalid address");
}
std::shared_ptr<CReserveScript> coinbaseScript = std::make_shared<CReserveScript>();
coinbaseScript->reserveScript = GetScriptForDestination(destination);
return generateBlocks(coinbaseScript, nGenerate, nMaxTries, false);
}
static UniValue getmininginfo(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0) {
throw std::runtime_error(
RPCHelpMan{"getmininginfo",
"\nReturns a json object containing mining-related information.",
{},
RPCResult{
"{\n"
" \"blocks\": nnn, (numeric) The current block\n"
" \"currentblockweight\": nnn, (numeric, optional) The block weight of the last assembled block (only present if a block was ever assembled)\n"
" \"currentblocktx\": nnn, (numeric, optional) The number of block transactions of the last assembled block (only present if a block was ever assembled)\n"
" \"difficulty\": xxx.xxxxx (numeric) The current difficulty\n"
" \"networkhashps\": nnn, (numeric) The network hashes per second\n"
" \"pooledtx\": n (numeric) The size of the mempool\n"
" \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n"
" \"warnings\": \"...\" (string) any network and blockchain warnings\n"
"}\n"
},
RPCExamples{
HelpExampleCli("getmininginfo", "")
+ HelpExampleRpc("getmininginfo", "")
},
}.ToString());
}
LOCK(cs_main);
UniValue obj(UniValue::VOBJ);
obj.pushKV("blocks", (int)chainActive.Height());
if (BlockAssembler::m_last_block_weight) obj.pushKV("currentblockweight", *BlockAssembler::m_last_block_weight);
if (BlockAssembler::m_last_block_num_txs) obj.pushKV("currentblocktx", *BlockAssembler::m_last_block_num_txs);
obj.pushKV("difficulty", (double)GetDifficulty(chainActive.Tip()));
obj.pushKV("networkhashps", getnetworkhashps(request));
obj.pushKV("pooledtx", (uint64_t)mempool.size());
obj.pushKV("chain", Params().NetworkIDString());
obj.pushKV("warnings", GetWarnings("statusbar"));
return obj;
}
// NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts
static UniValue prioritisetransaction(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 3)
throw std::runtime_error(
RPCHelpMan{"prioritisetransaction",
"Accepts the transaction into mined blocks at a higher (or lower) priority\n",
{
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id."},
{"dummy", RPCArg::Type::NUM, RPCArg::Optional::OMITTED_NAMED_ARG, "API-Compatibility for previous API. Must be zero or null.\n"
" DEPRECATED. For forward compatibility use named arguments and omit this parameter."},
{"fee_delta", RPCArg::Type::NUM, RPCArg::Optional::NO, "The fee value (in satoshis) to add (or subtract, if negative).\n"
" Note, that this value is not a fee rate. It is a value to modify absolute fee of the TX.\n"
" The fee is not actually paid, only the algorithm for selecting transactions into a block\n"
" considers the transaction as it would have paid a higher (or lower) fee."},
},
RPCResult{
"true (boolean) Returns true\n"
},
RPCExamples{
HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000")
+ HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000")
},
}.ToString());
LOCK(cs_main);
uint256 hash(ParseHashV(request.params[0], "txid"));
CAmount nAmount = request.params[2].get_int64();
if (!(request.params[1].isNull() || request.params[1].get_real() == 0)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Priority is no longer supported, dummy argument to prioritisetransaction must be 0.");
}
mempool.PrioritiseTransaction(hash, nAmount);
return true;
}
// NOTE: Assumes a conclusive result; if result is inconclusive, it must be handled by caller
static UniValue BIP22ValidationResult(const CValidationState& state)
{
if (state.IsValid())
return NullUniValue;
if (state.IsError())
throw JSONRPCError(RPC_VERIFY_ERROR, FormatStateMessage(state));
if (state.IsInvalid())
{
std::string strRejectReason = state.GetRejectReason();
if (strRejectReason.empty())
return "rejected";
return strRejectReason;
}
// Should be impossible
return "valid?";
}
static std::string gbt_vb_name(const Consensus::DeploymentPos pos) {
const struct VBDeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
std::string s = vbinfo.name;
if (!vbinfo.gbt_force) {
s.insert(s.begin(), '!');
}
return s;
}
static UniValue getblocktemplate(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
RPCHelpMan{"getblocktemplate",
"\nIf the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.\n"
"It returns data needed to construct a block to work on.\n"
"For full specification, see BIPs 22, 23, 9, and 145:\n"
" https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki\n"
" https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki\n"
" https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes\n"
" https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki\n",
{
{"template_request", RPCArg::Type::OBJ, RPCArg::Optional::NO, "A json object in the following spec",
{
{"mode", RPCArg::Type::STR, /* treat as named arg */ RPCArg::Optional::OMITTED_NAMED_ARG, "This must be set to \"template\", \"proposal\" (see BIP 23), or omitted"},
{"capabilities", RPCArg::Type::ARR, /* treat as named arg */ RPCArg::Optional::OMITTED_NAMED_ARG, "A list of strings",
{
{"support", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid'"},
},
},
{"rules", RPCArg::Type::ARR, RPCArg::Optional::NO, "A list of strings",
{
{"support", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "client side supported softfork deployment"},
},
},
},
"\"template_request\""},
},
RPCResult{
"{\n"
" \"version\" : n, (numeric) The preferred block version\n"
" \"rules\" : [ \"rulename\", ... ], (array of strings) specific block rules that are to be enforced\n"
" \"vbavailable\" : { (json object) set of pending, supported versionbit (BIP 9) softfork deployments\n"
" \"rulename\" : bitnumber (numeric) identifies the bit number as indicating acceptance and readiness for the named softfork rule\n"
" ,...\n"
" },\n"
" \"vbrequired\" : n, (numeric) bit mask of versionbits the server requires set in submissions\n"
" \"previousblockhash\" : \"xxxx\", (string) The hash of current highest block\n"
" \"transactions\" : [ (array) contents of non-coinbase transactions that should be included in the next block\n"
" {\n"
" \"data\" : \"xxxx\", (string) transaction data encoded in hexadecimal (byte-for-byte)\n"
" \"txid\" : \"xxxx\", (string) transaction id encoded in little-endian hexadecimal\n"
" \"hash\" : \"xxxx\", (string) hash encoded in little-endian hexadecimal (including witness data)\n"
" \"depends\" : [ (array) array of numbers \n"
" n (numeric) transactions before this one (by 1-based index in 'transactions' list) that must be present in the final block if this one is\n"
" ,...\n"
" ],\n"
" \"fee\": n, (numeric) difference in value between transaction inputs and outputs (in satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one\n"
" \"sigops\" : n, (numeric) total SigOps cost, as counted for purposes of block limits; if key is not present, sigop cost is unknown and clients MUST NOT assume it is zero\n"
" \"weight\" : n, (numeric) total transaction weight, as counted for purposes of block limits\n"
" }\n"
" ,...\n"
" ],\n"
" \"coinbaseaux\" : { (json object) data that should be included in the coinbase's scriptSig content\n"
" \"flags\" : \"xx\" (string) key name is to be ignored, and value included in scriptSig\n"
" },\n"
" \"coinbasevalue\" : n, (numeric) maximum allowable input to coinbase transaction, including the generation award and transaction fees (in satoshis)\n"
" \"coinbasetxn\" : { ... }, (json object) information for coinbase transaction\n"
" \"target\" : \"xxxx\", (string) The hash target\n"
" \"mintime\" : xxx, (numeric) The minimum timestamp appropriate for next block time in seconds since epoch (Jan 1 1970 GMT)\n"
" \"mutable\" : [ (array of string) list of ways the block template may be changed \n"
" \"value\" (string) A way the block template may be changed, e.g. 'time', 'transactions', 'prevblock'\n"
" ,...\n"
" ],\n"
" \"noncerange\" : \"00000000ffffffff\",(string) A range of valid nonces\n"
" \"sigoplimit\" : n, (numeric) limit of sigops in blocks\n"
" \"sizelimit\" : n, (numeric) limit of block size\n"
" \"weightlimit\" : n, (numeric) limit of block weight\n"
" \"curtime\" : ttt, (numeric) current timestamp in seconds since epoch (Jan 1 1970 GMT)\n"
" \"bits\" : \"xxxxxxxx\", (string) compressed target of next block\n"
" \"height\" : n (numeric) The height of the next block\n"
"}\n"
},
RPCExamples{
HelpExampleCli("getblocktemplate", "'{\"rules\": [\"segwit\"]}'")
+ HelpExampleRpc("getblocktemplate", "{\"rules\": [\"segwit\"]}")
},
}.ToString());
LOCK(cs_main);
std::string strMode = "template";
UniValue lpval = NullUniValue;
std::set<std::string> setClientRules;
int64_t nMaxVersionPreVB = -1;
if (!request.params[0].isNull())
{
const UniValue& oparam = request.params[0].get_obj();
const UniValue& modeval = find_value(oparam, "mode");
if (modeval.isStr())
strMode = modeval.get_str();
else if (modeval.isNull())
{
/* Do nothing */
}
else
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
lpval = find_value(oparam, "longpollid");
if (strMode == "proposal")
{
const UniValue& dataval = find_value(oparam, "data");
if (!dataval.isStr())
throw JSONRPCError(RPC_TYPE_ERROR, "Missing data String key for proposal");
CBlock block;
if (!DecodeHexBlk(block, dataval.get_str()))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
uint256 hash = block.GetHash();
const CBlockIndex* pindex = LookupBlockIndex(hash);
if (pindex) {
if (pindex->IsValid(BLOCK_VALID_SCRIPTS))
return "duplicate";
if (pindex->nStatus & BLOCK_FAILED_MASK)
return "duplicate-invalid";
return "duplicate-inconclusive";
}
CBlockIndex* const pindexPrev = chainActive.Tip();
// TestBlockValidity only supports blocks built on the current Tip
if (block.hashPrevBlock != pindexPrev->GetBlockHash())
return "inconclusive-not-best-prevblk";
CValidationState state;
TestBlockValidity(state, Params(), block, pindexPrev, false, true);
return BIP22ValidationResult(state);
}
const UniValue& aClientRules = find_value(oparam, "rules");
if (aClientRules.isArray()) {
for (unsigned int i = 0; i < aClientRules.size(); ++i) {
const UniValue& v = aClientRules[i];
setClientRules.insert(v.get_str());
}
} else {
// NOTE: It is important that this NOT be read if versionbits is supported
const UniValue& uvMaxVersion = find_value(oparam, "maxversion");
if (uvMaxVersion.isNum()) {
nMaxVersionPreVB = uvMaxVersion.get_int64();
}
}
}
if (strMode != "template")
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
if(!g_connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
if (g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL) == 0)
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Eloncoin is not connected!");
if (IsInitialBlockDownload())
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Eloncoin is downloading blocks...");
static unsigned int nTransactionsUpdatedLast;
if (!lpval.isNull())
{
// Wait to respond until either the best block changes, OR a minute has passed and there are more transactions
uint256 hashWatchedChain;
std::chrono::steady_clock::time_point checktxtime;
unsigned int nTransactionsUpdatedLastLP;
if (lpval.isStr())
{
// Format: <hashBestChain><nTransactionsUpdatedLast>
std::string lpstr = lpval.get_str();
hashWatchedChain = ParseHashV(lpstr.substr(0, 64), "longpollid");
nTransactionsUpdatedLastLP = atoi64(lpstr.substr(64));
}
else
{
// NOTE: Spec does not specify behaviour for non-string longpollid, but this makes testing easier
hashWatchedChain = chainActive.Tip()->GetBlockHash();
nTransactionsUpdatedLastLP = nTransactionsUpdatedLast;
}
// Release the wallet and main lock while waiting
LEAVE_CRITICAL_SECTION(cs_main);
{
checktxtime = std::chrono::steady_clock::now() + std::chrono::minutes(1);
WAIT_LOCK(g_best_block_mutex, lock);
while (g_best_block == hashWatchedChain && IsRPCRunning())
{
if (g_best_block_cv.wait_until(lock, checktxtime) == std::cv_status::timeout)
{
// Timeout: Check transactions for update
if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLastLP)
break;
checktxtime += std::chrono::seconds(10);
}
}
}
ENTER_CRITICAL_SECTION(cs_main);
if (!IsRPCRunning())
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Shutting down");
// TODO: Maybe recheck connections/IBD and (if something wrong) send an expires-immediately template to stop miners?
}
const struct VBDeploymentInfo& segwit_info = VersionBitsDeploymentInfo[Consensus::DEPLOYMENT_SEGWIT];
// GBT must be called with 'segwit' set in the rules
if (setClientRules.count(segwit_info.name) != 1) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "getblocktemplate must be called with the segwit rule set (call with {\"rules\": [\"segwit\"]})");
}
// Update block
static CBlockIndex* pindexPrev;
static int64_t nStart;
static std::unique_ptr<CBlockTemplate> pblocktemplate;
if (pindexPrev != chainActive.Tip() ||
(mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 5))
{
// Clear pindexPrev so future calls make a new block, despite any failures from here on
pindexPrev = nullptr;
// Store the pindexBest used before CreateNewBlock, to avoid races
nTransactionsUpdatedLast = mempool.GetTransactionsUpdated();
CBlockIndex* pindexPrevNew = chainActive.Tip();
nStart = GetTime();
// Create new block
CScript scriptDummy = CScript() << OP_TRUE;
pblocktemplate = BlockAssembler(Params()).CreateNewBlock(scriptDummy);
if (!pblocktemplate)
throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory");
// Need to update only after we know CreateNewBlock succeeded
pindexPrev = pindexPrevNew;
}
assert(pindexPrev);
CBlock* pblock = &pblocktemplate->block; // pointer for convenience
const Consensus::Params& consensusParams = Params().GetConsensus();
// Update nTime
UpdateTime(pblock, consensusParams, pindexPrev);
pblock->nNonce = 0;
// NOTE: If at some point we support pre-segwit miners post-segwit-activation, this needs to take segwit support into consideration
const bool fPreSegWit = (ThresholdState::ACTIVE != VersionBitsState(pindexPrev, consensusParams, Consensus::DEPLOYMENT_SEGWIT, versionbitscache));
UniValue aCaps(UniValue::VARR); aCaps.push_back("proposal");
UniValue transactions(UniValue::VARR);
std::map<uint256, int64_t> setTxIndex;
int i = 0;
for (const auto& it : pblock->vtx) {
const CTransaction& tx = *it;
uint256 txHash = tx.GetHash();
setTxIndex[txHash] = i++;
if (tx.IsCoinBase())
continue;
UniValue entry(UniValue::VOBJ);
entry.pushKV("data", EncodeHexTx(tx));
entry.pushKV("txid", txHash.GetHex());
entry.pushKV("hash", tx.GetWitnessHash().GetHex());
UniValue deps(UniValue::VARR);
for (const CTxIn &in : tx.vin)
{
if (setTxIndex.count(in.prevout.hash))
deps.push_back(setTxIndex[in.prevout.hash]);
}
entry.pushKV("depends", deps);
int index_in_template = i - 1;
entry.pushKV("fee", pblocktemplate->vTxFees[index_in_template]);
int64_t nTxSigOps = pblocktemplate->vTxSigOpsCost[index_in_template];
if (fPreSegWit) {
assert(nTxSigOps % WITNESS_SCALE_FACTOR == 0);
nTxSigOps /= WITNESS_SCALE_FACTOR;
}
entry.pushKV("sigops", nTxSigOps);
entry.pushKV("weight", GetTransactionWeight(tx));
transactions.push_back(entry);
}
UniValue aux(UniValue::VOBJ);
aux.pushKV("flags", HexStr(COINBASE_FLAGS.begin(), COINBASE_FLAGS.end()));
arith_uint256 hashTarget = arith_uint256().SetCompact(pblock->nBits);
UniValue aMutable(UniValue::VARR);
aMutable.push_back("time");
aMutable.push_back("transactions");
aMutable.push_back("prevblock");
UniValue result(UniValue::VOBJ);
result.pushKV("capabilities", aCaps);
UniValue aRules(UniValue::VARR);
UniValue vbavailable(UniValue::VOBJ);
for (int j = 0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) {
Consensus::DeploymentPos pos = Consensus::DeploymentPos(j);
ThresholdState state = VersionBitsState(pindexPrev, consensusParams, pos, versionbitscache);
switch (state) {
case ThresholdState::DEFINED:
case ThresholdState::FAILED:
// Not exposed to GBT at all
break;
case ThresholdState::LOCKED_IN:
// Ensure bit is set in block version
pblock->nVersion |= VersionBitsMask(consensusParams, pos);
// FALL THROUGH to get vbavailable set...
case ThresholdState::STARTED:
{
const struct VBDeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
vbavailable.pushKV(gbt_vb_name(pos), consensusParams.vDeployments[pos].bit);
if (setClientRules.find(vbinfo.name) == setClientRules.end()) {
if (!vbinfo.gbt_force) {
// If the client doesn't support this, don't indicate it in the [default] version
pblock->nVersion &= ~VersionBitsMask(consensusParams, pos);
}
}
break;
}
case ThresholdState::ACTIVE:
{
// Add to rules only
const struct VBDeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
aRules.push_back(gbt_vb_name(pos));
if (setClientRules.find(vbinfo.name) == setClientRules.end()) {
// Not supported by the client; make sure it's safe to proceed
if (!vbinfo.gbt_force) {
// If we do anything other than throw an exception here, be sure version/force isn't sent to old clients
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Support for '%s' rule requires explicit client support", vbinfo.name));
}
}
break;
}
}
}
result.pushKV("version", pblock->nVersion);
result.pushKV("rules", aRules);
result.pushKV("vbavailable", vbavailable);
result.pushKV("vbrequired", int(0));
if (nMaxVersionPreVB >= 2) {
// If VB is supported by the client, nMaxVersionPreVB is -1, so we won't get here
// Because BIP 34 changed how the generation transaction is serialized, we can only use version/force back to v2 blocks
// This is safe to do [otherwise-]unconditionally only because we are throwing an exception above if a non-force deployment gets activated
// Note that this can probably also be removed entirely after the first BIP9 non-force deployment (ie, probably segwit) gets activated
aMutable.push_back("version/force");
}
result.pushKV("previousblockhash", pblock->hashPrevBlock.GetHex());
result.pushKV("transactions", transactions);
result.pushKV("coinbaseaux", aux);
result.pushKV("coinbasevalue", (int64_t)pblock->vtx[0]->vout[0].nValue);
result.pushKV("longpollid", chainActive.Tip()->GetBlockHash().GetHex() + i64tostr(nTransactionsUpdatedLast));
result.pushKV("target", hashTarget.GetHex());
result.pushKV("mintime", (int64_t)pindexPrev->GetMedianTimePast()+1);
result.pushKV("mutable", aMutable);
result.pushKV("noncerange", "00000000ffffffff");
int64_t nSigOpLimit = MAX_BLOCK_SIGOPS_COST;
int64_t nSizeLimit = MAX_BLOCK_SERIALIZED_SIZE;
if (fPreSegWit) {
assert(nSigOpLimit % WITNESS_SCALE_FACTOR == 0);
nSigOpLimit /= WITNESS_SCALE_FACTOR;
assert(nSizeLimit % WITNESS_SCALE_FACTOR == 0);
nSizeLimit /= WITNESS_SCALE_FACTOR;
}
result.pushKV("sigoplimit", nSigOpLimit);
result.pushKV("sizelimit", nSizeLimit);
if (!fPreSegWit) {
result.pushKV("weightlimit", (int64_t)MAX_BLOCK_WEIGHT);
}
result.pushKV("curtime", pblock->GetBlockTime());
result.pushKV("bits", strprintf("%08x", pblock->nBits));
result.pushKV("height", (int64_t)(pindexPrev->nHeight+1));
if (!pblocktemplate->vchCoinbaseCommitment.empty()) {
result.pushKV("default_witness_commitment", HexStr(pblocktemplate->vchCoinbaseCommitment.begin(), pblocktemplate->vchCoinbaseCommitment.end()));
}
return result;
}
class submitblock_StateCatcher : public CValidationInterface
{
public:
uint256 hash;
bool found;
CValidationState state;
explicit submitblock_StateCatcher(const uint256 &hashIn) : hash(hashIn), found(false), state() {}
protected:
void BlockChecked(const CBlock& block, const CValidationState& stateIn) override {
if (block.GetHash() != hash)
return;
found = true;
state = stateIn;
}
};
static UniValue submitblock(const JSONRPCRequest& request)
{
// We allow 2 arguments for compliance with BIP22. Argument 2 is ignored.
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error(
RPCHelpMan{"submitblock",
"\nAttempts to submit new block to network.\n"
"See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n",
{
{"hexdata", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hex-encoded block data to submit"},
{"dummy", RPCArg::Type::STR, /* default */ "ignored", "dummy value, for compatibility with BIP22. This value is ignored."},
},
RPCResults{},
RPCExamples{
HelpExampleCli("submitblock", "\"mydata\"")
+ HelpExampleRpc("submitblock", "\"mydata\"")
},
}.ToString());
}
std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>();
CBlock& block = *blockptr;
if (!DecodeHexBlk(block, request.params[0].get_str())) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
}
if (block.vtx.empty() || !block.vtx[0]->IsCoinBase()) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block does not start with a coinbase");
}
uint256 hash = block.GetHash();
{
LOCK(cs_main);
const CBlockIndex* pindex = LookupBlockIndex(hash);
if (pindex) {
if (pindex->IsValid(BLOCK_VALID_SCRIPTS)) {
return "duplicate";
}
if (pindex->nStatus & BLOCK_FAILED_MASK) {
return "duplicate-invalid";
}
}
}
{
LOCK(cs_main);
const CBlockIndex* pindex = LookupBlockIndex(block.hashPrevBlock);
if (pindex) {
UpdateUncommittedBlockStructures(block, pindex, Params().GetConsensus());
}
}
bool new_block;
submitblock_StateCatcher sc(block.GetHash());
RegisterValidationInterface(&sc);
bool accepted = ProcessNewBlock(Params(), blockptr, /* fForceProcessing */ true, /* fNewBlock */ &new_block);
UnregisterValidationInterface(&sc);
if (!new_block && accepted) {
return "duplicate";
}
if (!sc.found) {
return "inconclusive";
}
return BIP22ValidationResult(sc.state);
}
static UniValue submitheader(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error(
RPCHelpMan{"submitheader",
"\nDecode the given hexdata as a header and submit it as a candidate chain tip if valid."
"\nThrows when the header is invalid.\n",
{
{"hexdata", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hex-encoded block header data"},
},
RPCResult{
"None"
},
RPCExamples{
HelpExampleCli("submitheader", "\"aabbcc\"") +
HelpExampleRpc("submitheader", "\"aabbcc\"")
},
}.ToString());
}
CBlockHeader h;
if (!DecodeHexBlockHeader(h, request.params[0].get_str())) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block header decode failed");
}
{
LOCK(cs_main);
if (!LookupBlockIndex(h.hashPrevBlock)) {
throw JSONRPCError(RPC_VERIFY_ERROR, "Must submit previous header (" + h.hashPrevBlock.GetHex() + ") first");
}
}
CValidationState state;
ProcessNewBlockHeaders({h}, state, Params(), /* ppindex */ nullptr, /* first_invalid */ nullptr);
if (state.IsValid()) return NullUniValue;
if (state.IsError()) {
throw JSONRPCError(RPC_VERIFY_ERROR, FormatStateMessage(state));
}
throw JSONRPCError(RPC_VERIFY_ERROR, state.GetRejectReason());
}
static UniValue estimatesmartfee(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
RPCHelpMan{"estimatesmartfee",
"\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
"confirmation within conf_target blocks if possible and return the number of blocks\n"
"for which the estimate is valid. Uses virtual transaction size as defined\n"
"in BIP 141 (witness data is discounted).\n",
{
{"conf_target", RPCArg::Type::NUM, RPCArg::Optional::NO, "Confirmation target in blocks (1 - 1008)"},
{"estimate_mode", RPCArg::Type::STR, /* default */ "CONSERVATIVE", "The fee estimate mode.\n"
" Whether to return a more conservative estimate which also satisfies\n"
" a longer history. A conservative estimate potentially returns a\n"
" higher feerate and is more likely to be sufficient for the desired\n"
" target, but is not as responsive to short term drops in the\n"
" prevailing fee market. Must be one of:\n"
" \"UNSET\"\n"
" \"ECONOMICAL\"\n"
" \"CONSERVATIVE\""},
},
RPCResult{
"{\n"
" \"feerate\" : x.x, (numeric, optional) estimate fee rate in " + CURRENCY_UNIT + "/kB\n"
" \"errors\": [ str... ] (json array of strings, optional) Errors encountered during processing\n"
" \"blocks\" : n (numeric) block number where estimate was found\n"
"}\n"
"\n"
"The request target will be clamped between 2 and the highest target\n"
"fee estimation is able to return based on how long it has been running.\n"
"An error is returned if not enough transactions and blocks\n"
"have been observed to make an estimate for any number of blocks.\n"
},
RPCExamples{
HelpExampleCli("estimatesmartfee", "6")
},
}.ToString());
RPCTypeCheck(request.params, {UniValue::VNUM, UniValue::VSTR});
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
unsigned int conf_target = ParseConfirmTarget(request.params[0]);
bool conservative = true;
if (!request.params[1].isNull()) {
FeeEstimateMode fee_mode;
if (!FeeModeFromString(request.params[1].get_str(), fee_mode)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter");
}
if (fee_mode == FeeEstimateMode::ECONOMICAL) conservative = false;
}
UniValue result(UniValue::VOBJ);
UniValue errors(UniValue::VARR);
FeeCalculation feeCalc;
CFeeRate feeRate = ::feeEstimator.estimateSmartFee(conf_target, &feeCalc, conservative);
if (feeRate != CFeeRate(0)) {
result.pushKV("feerate", ValueFromAmount(feeRate.GetFeePerK()));
} else {
errors.push_back("Insufficient data or no feerate found");
result.pushKV("errors", errors);
}
result.pushKV("blocks", feeCalc.returnedTarget);
return result;
}
static UniValue estimaterawfee(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
RPCHelpMan{"estimaterawfee",
"\nWARNING: This interface is unstable and may disappear or change!\n"
"\nWARNING: This is an advanced API call that is tightly coupled to the specific\n"
" implementation of fee estimation. The parameters it can be called with\n"
" and the results it returns will change if the internal implementation changes.\n"
"\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
"confirmation within conf_target blocks if possible. Uses virtual transaction size as\n"
"defined in BIP 141 (witness data is discounted).\n",
{
{"conf_target", RPCArg::Type::NUM, RPCArg::Optional::NO, "Confirmation target in blocks (1 - 1008)"},
{"threshold", RPCArg::Type::NUM, /* default */ "0.95", "The proportion of transactions in a given feerate range that must have been\n"
" confirmed within conf_target in order to consider those feerates as high enough and proceed to check\n"
" lower buckets."},
},
RPCResult{
"{\n"
" \"short\" : { (json object, optional) estimate for short time horizon\n"
" \"feerate\" : x.x, (numeric, optional) estimate fee rate in " + CURRENCY_UNIT + "/kB\n"
" \"decay\" : x.x, (numeric) exponential decay (per block) for historical moving average of confirmation data\n"
" \"scale\" : x, (numeric) The resolution of confirmation targets at this time horizon\n"
" \"pass\" : { (json object, optional) information about the lowest range of feerates to succeed in meeting the threshold\n"
" \"startrange\" : x.x, (numeric) start of feerate range\n"
" \"endrange\" : x.x, (numeric) end of feerate range\n"
" \"withintarget\" : x.x, (numeric) number of txs over history horizon in the feerate range that were confirmed within target\n"
" \"totalconfirmed\" : x.x, (numeric) number of txs over history horizon in the feerate range that were confirmed at any point\n"
" \"inmempool\" : x.x, (numeric) current number of txs in mempool in the feerate range unconfirmed for at least target blocks\n"
" \"leftmempool\" : x.x, (numeric) number of txs over history horizon in the feerate range that left mempool unconfirmed after target\n"
" },\n"
" \"fail\" : { ... }, (json object, optional) information about the highest range of feerates to fail to meet the threshold\n"
" \"errors\": [ str... ] (json array of strings, optional) Errors encountered during processing\n"
" },\n"
" \"medium\" : { ... }, (json object, optional) estimate for medium time horizon\n"
" \"long\" : { ... } (json object) estimate for long time horizon\n"
"}\n"
"\n"
"Results are returned for any horizon which tracks blocks up to the confirmation target.\n"
},
RPCExamples{
HelpExampleCli("estimaterawfee", "6 0.9")
},
}.ToString());
RPCTypeCheck(request.params, {UniValue::VNUM, UniValue::VNUM}, true);
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
unsigned int conf_target = ParseConfirmTarget(request.params[0]);
double threshold = 0.95;
if (!request.params[1].isNull()) {
threshold = request.params[1].get_real();
}
if (threshold < 0 || threshold > 1) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid threshold");
}
UniValue result(UniValue::VOBJ);
for (const FeeEstimateHorizon horizon : {FeeEstimateHorizon::SHORT_HALFLIFE, FeeEstimateHorizon::MED_HALFLIFE, FeeEstimateHorizon::LONG_HALFLIFE}) {
CFeeRate feeRate;
EstimationResult buckets;
// Only output results for horizons which track the target
if (conf_target > ::feeEstimator.HighestTargetTracked(horizon)) continue;
feeRate = ::feeEstimator.estimateRawFee(conf_target, threshold, horizon, &buckets);
UniValue horizon_result(UniValue::VOBJ);
UniValue errors(UniValue::VARR);
UniValue passbucket(UniValue::VOBJ);
passbucket.pushKV("startrange", round(buckets.pass.start));
passbucket.pushKV("endrange", round(buckets.pass.end));
passbucket.pushKV("withintarget", round(buckets.pass.withinTarget * 100.0) / 100.0);
passbucket.pushKV("totalconfirmed", round(buckets.pass.totalConfirmed * 100.0) / 100.0);
passbucket.pushKV("inmempool", round(buckets.pass.inMempool * 100.0) / 100.0);
passbucket.pushKV("leftmempool", round(buckets.pass.leftMempool * 100.0) / 100.0);
UniValue failbucket(UniValue::VOBJ);
failbucket.pushKV("startrange", round(buckets.fail.start));
failbucket.pushKV("endrange", round(buckets.fail.end));
failbucket.pushKV("withintarget", round(buckets.fail.withinTarget * 100.0) / 100.0);
failbucket.pushKV("totalconfirmed", round(buckets.fail.totalConfirmed * 100.0) / 100.0);
failbucket.pushKV("inmempool", round(buckets.fail.inMempool * 100.0) / 100.0);
failbucket.pushKV("leftmempool", round(buckets.fail.leftMempool * 100.0) / 100.0);
// CFeeRate(0) is used to indicate error as a return value from estimateRawFee
if (feeRate != CFeeRate(0)) {
horizon_result.pushKV("feerate", ValueFromAmount(feeRate.GetFeePerK()));
horizon_result.pushKV("decay", buckets.decay);
horizon_result.pushKV("scale", (int)buckets.scale);
horizon_result.pushKV("pass", passbucket);
// buckets.fail.start == -1 indicates that all buckets passed, there is no fail bucket to output
if (buckets.fail.start != -1) horizon_result.pushKV("fail", failbucket);
} else {
// Output only information that is still meaningful in the event of error
horizon_result.pushKV("decay", buckets.decay);
horizon_result.pushKV("scale", (int)buckets.scale);
horizon_result.pushKV("fail", failbucket);
errors.push_back("Insufficient data or no feerate found which meets threshold");
horizon_result.pushKV("errors",errors);
}
result.pushKV(StringForFeeEstimateHorizon(horizon), horizon_result);
}
return result;
}
// clang-format off
static const CRPCCommand commands[] =
{ // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ----------
{ "mining", "getnetworkhashps", &getnetworkhashps, {"nblocks","height"} },
{ "mining", "getmininginfo", &getmininginfo, {} },
{ "mining", "prioritisetransaction", &prioritisetransaction, {"txid","dummy","fee_delta"} },
{ "mining", "getblocktemplate", &getblocktemplate, {"template_request"} },
{ "mining", "submitblock", &submitblock, {"hexdata","dummy"} },
{ "mining", "submitheader", &submitheader, {"hexdata"} },
{ "generating", "generatetoaddress", &generatetoaddress, {"nblocks","address","maxtries"} },
{ "util", "estimatesmartfee", &estimatesmartfee, {"conf_target", "estimate_mode"} },
{ "hidden", "estimaterawfee", &estimaterawfee, {"conf_target", "threshold"} },
};
// clang-format on
void RegisterMiningRPCCommands(CRPCTable &t)
{
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
}
|
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include "ConvBaseProjection.h"
#include "paddle/legacy/utils/Stat.h"
namespace paddle {
ThreadLocalD<std::vector<MemoryHandlePtr>> ConvBaseProjection::convMem_;
ConvBaseProjection::ConvBaseProjection(const ProjectionConfig &config,
ParameterPtr parameter,
bool useGpu)
: Projection(config, parameter, useGpu) {
CHECK(useGpu); // only support GPU
getConvParams();
initCudnn();
size_t height = filterH_ * filterW_ * channels_ / groups_;
size_t width = numFilters_;
weight_.reset(new Weight(height, width, parameter));
weightOffset_ = height * width / groups_;
}
void ConvBaseProjection::getConvParams() {
const ConvConfig &conf = config_.conv_conf();
paddingH_ = conf.padding_y();
paddingW_ = conf.padding();
strideH_ = conf.stride_y();
strideW_ = conf.stride();
dilationH_ = conf.dilation_y();
dilationW_ = conf.dilation();
CHECK_GT(dilationH_, 0);
CHECK_GT(dilationW_, 0);
filterH_ = conf.filter_size_y();
filterW_ = conf.filter_size();
configImgH_ = conf.has_img_size_y() ? conf.img_size_y() : conf.img_size();
configImgW_ = conf.img_size();
configOutH_ = conf.has_output_y() ? conf.output_y() : conf.output_x();
configOutW_ = conf.output_x();
configChannels_ = conf.channels();
configNumFilters_ = config_.num_filters();
isDeconv_ = (config_.type() == "conv") ? false : true;
channels_ = (isDeconv_) ? configNumFilters_ : configChannels_;
numFilters_ = (isDeconv_) ? configChannels_ : configNumFilters_;
groups_ = conf.groups();
CHECK_EQ(channels_ % groups_, 0);
CHECK_EQ(numFilters_ % groups_, 0);
}
void ConvBaseProjection::initCudnn() {
hl_create_filter_descriptor(&filterDesc_,
channels_ / groups_,
numFilters_ / groups_,
filterH_,
filterW_);
hl_create_tensor_descriptor(&imageDesc_);
hl_create_tensor_descriptor(&outputDesc_);
hl_create_convolution_descriptor(&convDesc_,
imageDesc_,
filterDesc_,
paddingH_,
paddingW_,
strideH_,
strideW_,
dilationH_,
dilationW_);
// initialize all to default algorithms
fwdAlgo_ = 0;
bwdFilterAlgo_ = 0;
bwdDataAlgo_ = 0;
fwdLimitBytes_ = 0;
bwdDataLimitBytes_ = 0;
bwdFilterLimitBytes_ = 0;
workSpaceInBytes_ = 0;
}
void ConvBaseProjection::reshapeTensorDesc(int batchSize) {
// The stride between two consecutive samples in the output of ConvProjection
// may not be numFilters_ * outputH_ * outputW_ (conv) or
// channels_ * imageH_ * imageW_ (deconv)
// for example, in the case of layer ConcatenateLayer2 with two
// ConvProjection, the stride is the output_size of layer ConcatenateLayer2.
// So the calculation of nStride is different from CudnnConvLayer.
size_t nStrideImage, nStrideOutput;
if (isDeconv_) {
nStrideImage = out_->value->getStride();
nStrideOutput = numFilters_ * outputH_ * outputW_;
} else {
nStrideImage = channels_ * imageH_ * imageW_;
nStrideOutput = out_->value->getStride();
}
hl_tensor_reshape(imageDesc_,
batchSize,
channels_ / groups_,
imageH_,
imageW_,
nStrideImage,
imageH_ * imageW_,
imageW_,
1);
hl_tensor_reshape(outputDesc_,
batchSize,
numFilters_ / groups_,
outputH_,
outputW_,
nStrideOutput,
outputH_ * outputW_,
outputW_,
1);
hl_reset_convolution_descriptor(convDesc_,
imageDesc_,
filterDesc_,
paddingH_,
paddingW_,
strideH_,
strideW_,
dilationH_,
dilationW_);
}
void ConvBaseProjection::reshape(int batchSize) {
size_t width = calOutputSize();
CHECK_EQ(width, out_->value->getWidth());
CHECK_EQ(calInputSize(), in_->value->getWidth());
reshapeTensorDesc(batchSize);
bool useDilation = false;
if (dilationH_ > 1 || dilationW_ > 1) {
useDilation = true;
}
hl_conv_workspace(imageDesc_,
outputDesc_,
filterDesc_,
convDesc_,
&fwdAlgo_,
&fwdLimitBytes_,
&bwdDataAlgo_,
&bwdDataLimitBytes_,
&bwdFilterAlgo_,
&bwdFilterLimitBytes_,
useDilation);
size_t maxWorkSpace = 0;
maxWorkSpace = std::max(fwdLimitBytes_, bwdDataLimitBytes_);
maxWorkSpace = std::max(maxWorkSpace, bwdFilterLimitBytes_);
workSpaceInBytes_ = maxWorkSpace;
VLOG(3) << getName() << " Fwd / BwdData / BwdFilter algo: " << fwdAlgo_
<< " / " << bwdDataAlgo_ << " / " << bwdFilterAlgo_;
}
void *ConvBaseProjection::getSpaceBytes(size_t size) {
std::vector<MemoryHandlePtr> &convMem = *convMem_;
if (convMem.empty()) {
int numDevices = hl_get_device_count();
convMem.resize(numDevices);
}
int devId = hl_get_device();
MemoryHandlePtr localMem = convMem[devId];
if (NULL == localMem || size > localMem->getAllocSize()) {
localMem = std::make_shared<GpuMemoryHandle>(size);
}
return localMem->getBuf();
}
ConvBaseProjection::~ConvBaseProjection() {
hl_destroy_tensor_descriptor(imageDesc_);
hl_destroy_tensor_descriptor(outputDesc_);
hl_destroy_filter_descriptor(filterDesc_);
hl_destroy_convolution_descriptor(convDesc_);
}
} // namespace paddle
|
// Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
#include "beatsaber-hook/shared/utils/byref.hpp"
// Including type: System.ICloneable
#include "System/ICloneable.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
#include "beatsaber-hook/shared/utils/typedefs-array.hpp"
// Completed includes
// Type namespace: System.Runtime.Serialization.Formatters.Binary
namespace System::Runtime::Serialization::Formatters::Binary {
// Forward declaring type: IntSizedArray
class IntSizedArray;
}
#include "beatsaber-hook/shared/utils/il2cpp-type-check.hpp"
NEED_NO_BOX(::System::Runtime::Serialization::Formatters::Binary::IntSizedArray);
DEFINE_IL2CPP_ARG_TYPE(::System::Runtime::Serialization::Formatters::Binary::IntSizedArray*, "System.Runtime.Serialization.Formatters.Binary", "IntSizedArray");
// Type namespace: System.Runtime.Serialization.Formatters.Binary
namespace System::Runtime::Serialization::Formatters::Binary {
// Size: 0x20
#pragma pack(push, 1)
// Autogenerated type: System.Runtime.Serialization.Formatters.Binary.IntSizedArray
// [TokenAttribute] Offset: FFFFFFFF
// [DefaultMemberAttribute] Offset: 684D8C
class IntSizedArray : public ::Il2CppObject/*, public ::System::ICloneable*/ {
public:
public:
// System.Int32[] objects
// Size: 0x8
// Offset: 0x10
::ArrayW<int> objects;
// Field size check
static_assert(sizeof(::ArrayW<int>) == 0x8);
// System.Int32[] negObjects
// Size: 0x8
// Offset: 0x18
::ArrayW<int> negObjects;
// Field size check
static_assert(sizeof(::ArrayW<int>) == 0x8);
public:
// Creating interface conversion operator: operator ::System::ICloneable
operator ::System::ICloneable() noexcept {
return *reinterpret_cast<::System::ICloneable*>(this);
}
// Get instance field reference: System.Int32[] objects
[[deprecated("Use field access instead!")]] ::ArrayW<int>& dyn_objects();
// Get instance field reference: System.Int32[] negObjects
[[deprecated("Use field access instead!")]] ::ArrayW<int>& dyn_negObjects();
// System.Int32 get_Item(System.Int32 index)
// Offset: 0x106CB10
int get_Item(int index);
// System.Void set_Item(System.Int32 index, System.Int32 value)
// Offset: 0x106CB94
void set_Item(int index, int value);
// private System.Void .ctor(System.Runtime.Serialization.Formatters.Binary.IntSizedArray sizedArray)
// Offset: 0x106C9D4
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static IntSizedArray* New_ctor(::System::Runtime::Serialization::Formatters::Binary::IntSizedArray* sizedArray) {
static auto ___internal__logger = ::Logger::get().WithContext("::System::Runtime::Serialization::Formatters::Binary::IntSizedArray::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<IntSizedArray*, creationType>(sizedArray)));
}
// public System.Object Clone()
// Offset: 0x106CAB4
::Il2CppObject* Clone();
// System.Void IncreaseCapacity(System.Int32 index)
// Offset: 0x106CC54
void IncreaseCapacity(int index);
// public System.Void .ctor()
// Offset: 0x106C968
// Implemented from: System.Object
// Base method: System.Void Object::.ctor()
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static IntSizedArray* New_ctor() {
static auto ___internal__logger = ::Logger::get().WithContext("::System::Runtime::Serialization::Formatters::Binary::IntSizedArray::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<IntSizedArray*, creationType>()));
}
}; // System.Runtime.Serialization.Formatters.Binary.IntSizedArray
#pragma pack(pop)
static check_size<sizeof(IntSizedArray), 24 + sizeof(::ArrayW<int>)> __System_Runtime_Serialization_Formatters_Binary_IntSizedArraySizeCheck;
static_assert(sizeof(IntSizedArray) == 0x20);
}
#include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
// Writing MetadataGetter for method: System::Runtime::Serialization::Formatters::Binary::IntSizedArray::get_Item
// Il2CppName: get_Item
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<int (System::Runtime::Serialization::Formatters::Binary::IntSizedArray::*)(int)>(&System::Runtime::Serialization::Formatters::Binary::IntSizedArray::get_Item)> {
static const MethodInfo* get() {
static auto* index = &::il2cpp_utils::GetClassFromName("System", "Int32")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Runtime::Serialization::Formatters::Binary::IntSizedArray*), "get_Item", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{index});
}
};
// Writing MetadataGetter for method: System::Runtime::Serialization::Formatters::Binary::IntSizedArray::set_Item
// Il2CppName: set_Item
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Runtime::Serialization::Formatters::Binary::IntSizedArray::*)(int, int)>(&System::Runtime::Serialization::Formatters::Binary::IntSizedArray::set_Item)> {
static const MethodInfo* get() {
static auto* index = &::il2cpp_utils::GetClassFromName("System", "Int32")->byval_arg;
static auto* value = &::il2cpp_utils::GetClassFromName("System", "Int32")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Runtime::Serialization::Formatters::Binary::IntSizedArray*), "set_Item", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{index, value});
}
};
// Writing MetadataGetter for method: System::Runtime::Serialization::Formatters::Binary::IntSizedArray::New_ctor
// Il2CppName: .ctor
// Cannot get method pointer of value based method overload from template for constructor!
// Try using FindMethod instead!
// Writing MetadataGetter for method: System::Runtime::Serialization::Formatters::Binary::IntSizedArray::Clone
// Il2CppName: Clone
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::Il2CppObject* (System::Runtime::Serialization::Formatters::Binary::IntSizedArray::*)()>(&System::Runtime::Serialization::Formatters::Binary::IntSizedArray::Clone)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(System::Runtime::Serialization::Formatters::Binary::IntSizedArray*), "Clone", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: System::Runtime::Serialization::Formatters::Binary::IntSizedArray::IncreaseCapacity
// Il2CppName: IncreaseCapacity
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Runtime::Serialization::Formatters::Binary::IntSizedArray::*)(int)>(&System::Runtime::Serialization::Formatters::Binary::IntSizedArray::IncreaseCapacity)> {
static const MethodInfo* get() {
static auto* index = &::il2cpp_utils::GetClassFromName("System", "Int32")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Runtime::Serialization::Formatters::Binary::IntSizedArray*), "IncreaseCapacity", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{index});
}
};
// Writing MetadataGetter for method: System::Runtime::Serialization::Formatters::Binary::IntSizedArray::New_ctor
// Il2CppName: .ctor
// Cannot get method pointer of value based method overload from template for constructor!
// Try using FindMethod instead!
|
/*------------------------------------------------------------*/
/* filename - tmenubox.cpp */
/* */
/* function(s) */
/* TMenuBox member functions */
/*------------------------------------------------------------*/
/*
* Turbo Vision - Version 2.0
*
* Copyright (c) 1994 by Borland International
* All Rights Reserved.
*
*/
#define Uses_TRect
#define Uses_TMenu
#define Uses_TMenuItem
#define Uses_TMenuBox
#include <tvision/tv.h>
#if !defined( __STRING_H )
#include <string.h>
#endif // __STRING_H
static TRect getRect( const TRect& bounds, TMenu *aMenu )
{
short w = 10;
short h = 2;
if( aMenu != 0 )
{
for( TMenuItem *p = aMenu->items; p != 0; p = p->next )
{
if( p->name != 0 )
{
short l = cstrlen(p->name) + 6;
if( p->command == 0 )
l += 3;
else
if( p->param != 0 )
l += strwidth(p->param) + 2;
w = max( l, w );
}
h++;
}
}
TRect r( bounds );
if( r.a.x + w < r.b.x )
r.b.x = r.a.x + w;
else
r.a.x = r.b.x - w;
if (r.a.y + h < r.b.y)
r.b.y = r.a.y + h;
else
r.a.y = r.b.y - h;
return r;
}
TMenuBox::TMenuBox( const TRect& bounds,
TMenu *aMenu,
TMenuView *aParentMenu) :
TMenuView( getRect( bounds, aMenu ), aMenu, aParentMenu )
{
state |= sfShadow;
options |= ofPreProcess;
}
static ushort cNormal, color;
void TMenuBox::frameLine( TDrawBuffer& b, short n )
{
b.moveBuf( 0, &frameChars[n], cNormal, 2 );
b.moveChar( 2, frameChars[n+2], color, size.x - 4 );
b.moveBuf( size.x-2, &frameChars[n+3], cNormal, 2 );
}
void TMenuBox::draw()
{
TDrawBuffer b;
cNormal = getColor(0x0301);
ushort cSelect = getColor(0x0604);
ushort cNormDisabled = getColor(0x0202);
ushort cSelDisabled = getColor(0x0505);
short y = 0;
color = cNormal;
frameLine( b, 0 );
writeBuf( 0, y++, size.x, 1, b );
if( menu != 0 )
{
for( TMenuItem *p = menu->items; p != 0; p = p->next )
{
color = cNormal;
if( p->name == 0 )
frameLine( b, 15 );
else
{
if( p->disabled )
if( p == current )
color = cSelDisabled;
else
color = cNormDisabled;
else if( p == current )
color = cSelect;
frameLine( b, 10 );
b.moveCStr( 3, p->name, color );
if( p->command == 0 )
b.putChar( size.x-4, 16 );
else if( p->param != 0 )
b.moveStr( size.x-3-strwidth(p->param),
p->param,
color);
}
writeBuf( 0, y++, size.x, 1, b );
}
}
color = cNormal;
frameLine( b, 5 );
writeBuf( 0, y, size.x, 1, b );
}
TRect TMenuBox::getItemRect( TMenuItem *item )
{
short y = 1;
TMenuItem *p = menu->items;
while( p != item )
{
y++;
p = p->next;
}
return TRect( 2, y, size.x-2, y+1 );
}
#if !defined(NO_STREAMABLE)
TStreamable *TMenuBox::build()
{
return new TMenuBox( streamableInit );
}
TMenuBox::TMenuBox( StreamableInit ) : TMenuView( streamableInit )
{
}
#endif
|
#include "../geometric.hpp"
#include "../exponential.hpp"
#include "../trigonometric.hpp"
#include "../detail/type_vec1.hpp"
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <cmath>
namespace glm{
namespace detail
{
template <length_t L, typename T, qualifier Q>
struct compute_rand
{
GLM_FUNC_QUALIFIER static vec<L, T, Q> call();
};
template <qualifier P>
struct compute_rand<1, uint8, P>
{
GLM_FUNC_QUALIFIER static vec<1, uint8, P> call()
{
return vec<1, uint8, P>(
std::rand() % std::numeric_limits<uint8>::max());
}
};
template <qualifier P>
struct compute_rand<2, uint8, P>
{
GLM_FUNC_QUALIFIER static vec<2, uint8, P> call()
{
return vec<2, uint8, P>(
std::rand() % std::numeric_limits<uint8>::max(),
std::rand() % std::numeric_limits<uint8>::max());
}
};
template <qualifier P>
struct compute_rand<3, uint8, P>
{
GLM_FUNC_QUALIFIER static vec<3, uint8, P> call()
{
return vec<3, uint8, P>(
std::rand() % std::numeric_limits<uint8>::max(),
std::rand() % std::numeric_limits<uint8>::max(),
std::rand() % std::numeric_limits<uint8>::max());
}
};
template <qualifier P>
struct compute_rand<4, uint8, P>
{
GLM_FUNC_QUALIFIER static vec<4, uint8, P> call()
{
return vec<4, uint8, P>(
std::rand() % std::numeric_limits<uint8>::max(),
std::rand() % std::numeric_limits<uint8>::max(),
std::rand() % std::numeric_limits<uint8>::max(),
std::rand() % std::numeric_limits<uint8>::max());
}
};
template <length_t L, qualifier Q>
struct compute_rand<L, uint16, Q>
{
GLM_FUNC_QUALIFIER static vec<L, uint16, Q> call()
{
return
(vec<L, uint16, Q>(compute_rand<L, uint8, Q>::call()) << static_cast<uint16>(8)) |
(vec<L, uint16, Q>(compute_rand<L, uint8, Q>::call()) << static_cast<uint16>(0));
}
};
template <length_t L, qualifier Q>
struct compute_rand<L, uint32, Q>
{
GLM_FUNC_QUALIFIER static vec<L, uint32, Q> call()
{
return
(vec<L, uint32, Q>(compute_rand<L, uint16, Q>::call()) << static_cast<uint32>(16)) |
(vec<L, uint32, Q>(compute_rand<L, uint16, Q>::call()) << static_cast<uint32>(0));
}
};
template <length_t L, qualifier Q>
struct compute_rand<L, uint64, Q>
{
GLM_FUNC_QUALIFIER static vec<L, uint64, Q> call()
{
return
(vec<L, uint64, Q>(compute_rand<L, uint32, Q>::call()) << static_cast<uint64>(32)) |
(vec<L, uint64, Q>(compute_rand<L, uint32, Q>::call()) << static_cast<uint64>(0));
}
};
template <length_t L, typename T, qualifier Q>
struct compute_linearRand
{
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& Min, vec<L, T, Q> const& Max);
};
template<length_t L, qualifier Q>
struct compute_linearRand<L, int8, Q>
{
GLM_FUNC_QUALIFIER static vec<L, int8, Q> call(vec<L, int8, Q> const& Min, vec<L, int8, Q> const& Max)
{
return (vec<L, int8, Q>(compute_rand<L, uint8, Q>::call() % vec<L, uint8, Q>(Max + static_cast<int8>(1) - Min))) + Min;
}
};
template<length_t L, qualifier Q>
struct compute_linearRand<L, uint8, Q>
{
GLM_FUNC_QUALIFIER static vec<L, uint8, Q> call(vec<L, uint8, Q> const& Min, vec<L, uint8, Q> const& Max)
{
return (compute_rand<L, uint8, Q>::call() % (Max + static_cast<uint8>(1) - Min)) + Min;
}
};
template<length_t L, qualifier Q>
struct compute_linearRand<L, int16, Q>
{
GLM_FUNC_QUALIFIER static vec<L, int16, Q> call(vec<L, int16, Q> const& Min, vec<L, int16, Q> const& Max)
{
return (vec<L, int16, Q>(compute_rand<L, uint16, Q>::call() % vec<L, uint16, Q>(Max + static_cast<int16>(1) - Min))) + Min;
}
};
template<length_t L, qualifier Q>
struct compute_linearRand<L, uint16, Q>
{
GLM_FUNC_QUALIFIER static vec<L, uint16, Q> call(vec<L, uint16, Q> const& Min, vec<L, uint16, Q> const& Max)
{
return (compute_rand<L, uint16, Q>::call() % (Max + static_cast<uint16>(1) - Min)) + Min;
}
};
template<length_t L, qualifier Q>
struct compute_linearRand<L, int32, Q>
{
GLM_FUNC_QUALIFIER static vec<L, int32, Q> call(vec<L, int32, Q> const& Min, vec<L, int32, Q> const& Max)
{
return (vec<L, int32, Q>(compute_rand<L, uint32, Q>::call() % vec<L, uint32, Q>(Max + static_cast<int32>(1) - Min))) + Min;
}
};
template<length_t L, qualifier Q>
struct compute_linearRand<L, uint32, Q>
{
GLM_FUNC_QUALIFIER static vec<L, uint32, Q> call(vec<L, uint32, Q> const& Min, vec<L, uint32, Q> const& Max)
{
return (compute_rand<L, uint32, Q>::call() % (Max + static_cast<uint32>(1) - Min)) + Min;
}
};
template<length_t L, qualifier Q>
struct compute_linearRand<L, int64, Q>
{
GLM_FUNC_QUALIFIER static vec<L, int64, Q> call(vec<L, int64, Q> const& Min, vec<L, int64, Q> const& Max)
{
return (vec<L, int64, Q>(compute_rand<L, uint64, Q>::call() % vec<L, uint64, Q>(Max + static_cast<int64>(1) - Min))) + Min;
}
};
template<length_t L, qualifier Q>
struct compute_linearRand<L, uint64, Q>
{
GLM_FUNC_QUALIFIER static vec<L, uint64, Q> call(vec<L, uint64, Q> const& Min, vec<L, uint64, Q> const& Max)
{
return (compute_rand<L, uint64, Q>::call() % (Max + static_cast<uint64>(1) - Min)) + Min;
}
};
template<length_t L, qualifier Q>
struct compute_linearRand<L, float, Q>
{
GLM_FUNC_QUALIFIER static vec<L, float, Q> call(vec<L, float, Q> const& Min, vec<L, float, Q> const& Max)
{
return vec<L, float, Q>(compute_rand<L, uint32, Q>::call()) / static_cast<float>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
}
};
template<length_t L, qualifier Q>
struct compute_linearRand<L, double, Q>
{
GLM_FUNC_QUALIFIER static vec<L, double, Q> call(vec<L, double, Q> const& Min, vec<L, double, Q> const& Max)
{
return vec<L, double, Q>(compute_rand<L, uint64, Q>::call()) / static_cast<double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
}
};
template<length_t L, qualifier Q>
struct compute_linearRand<L, long double, Q>
{
GLM_FUNC_QUALIFIER static vec<L, long double, Q> call(vec<L, long double, Q> const& Min, vec<L, long double, Q> const& Max)
{
return vec<L, long double, Q>(compute_rand<L, uint64, Q>::call()) / static_cast<long double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
}
};
}//namespace detail
template<typename genType>
GLM_FUNC_QUALIFIER genType linearRand(genType Min, genType Max)
{
return detail::compute_linearRand<1, genType, highp>::call(
vec<1, genType, highp>(Min),
vec<1, genType, highp>(Max)).x;
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, T, Q> linearRand(vec<L, T, Q> const& Min, vec<L, T, Q> const& Max)
{
return detail::compute_linearRand<L, T, Q>::call(Min, Max);
}
template<typename genType>
GLM_FUNC_QUALIFIER genType gaussRand(genType Mean, genType Deviation)
{
genType w, x1, x2;
do
{
x1 = linearRand(genType(-1), genType(1));
x2 = linearRand(genType(-1), genType(1));
w = x1 * x1 + x2 * x2;
} while(w > genType(1));
return static_cast<genType>(x2 * Deviation * Deviation * sqrt((genType(-2) * log(w)) / w) + Mean);
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, T, Q> gaussRand(vec<L, T, Q> const& Mean, vec<L, T, Q> const& Deviation)
{
return detail::functor2<vec, L, T, Q>::call(gaussRand, Mean, Deviation);
}
template<typename T>
GLM_FUNC_QUALIFIER vec<2, T, defaultp> diskRand(T Radius)
{
assert(Radius > static_cast<T>(0));
vec<2, T, defaultp> Result(T(0));
T LenRadius(T(0));
do
{
Result = linearRand(
vec<2, T, defaultp>(-Radius),
vec<2, T, defaultp>(Radius));
LenRadius = length(Result);
}
while(LenRadius > Radius);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER vec<3, T, defaultp> ballRand(T Radius)
{
assert(Radius > static_cast<T>(0));
vec<3, T, defaultp> Result(T(0));
T LenRadius(T(0));
do
{
Result = linearRand(
vec<3, T, defaultp>(-Radius),
vec<3, T, defaultp>(Radius));
LenRadius = length(Result);
}
while(LenRadius > Radius);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER vec<2, T, defaultp> circularRand(T Radius)
{
assert(Radius > static_cast<T>(0));
T a = linearRand(T(0), static_cast<T>(6.283185307179586476925286766559));
return vec<2, T, defaultp>(glm::cos(a), glm::sin(a)) * Radius;
}
template<typename T>
GLM_FUNC_QUALIFIER vec<3, T, defaultp> sphericalRand(T Radius)
{
assert(Radius > static_cast<T>(0));
T theta = linearRand(T(0), T(6.283185307179586476925286766559f));
T phi = std::acos(linearRand(T(-1.0f), T(1.0f)));
T x = std::sin(phi) * std::cos(theta);
T y = std::sin(phi) * std::sin(theta);
T z = std::cos(phi);
return vec<3, T, defaultp>(x, y, z) * Radius;
}
}//namespace glm
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/drive/file_system/move_operation.h"
#include "chrome/browser/chromeos/drive/file_change.h"
#include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
#include "content/public/test/test_utils.h"
#include "google_apis/drive/test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace drive {
namespace file_system {
class MoveOperationTest : public OperationTestBase {
protected:
virtual void SetUp() override {
OperationTestBase::SetUp();
operation_.reset(new MoveOperation(blocking_task_runner(),
delegate(),
metadata()));
}
scoped_ptr<MoveOperation> operation_;
};
TEST_F(MoveOperationTest, MoveFileInSameDirectory) {
const base::FilePath src_path(
FILE_PATH_LITERAL("drive/root/Directory 1/SubDirectory File 1.txt"));
const base::FilePath dest_path(
FILE_PATH_LITERAL("drive/root/Directory 1/Test.log"));
ResourceEntry src_entry, dest_entry;
ASSERT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(src_path, &src_entry));
ASSERT_EQ(FILE_ERROR_NOT_FOUND,
GetLocalResourceEntry(dest_path, &dest_entry));
FileError error = FILE_ERROR_FAILED;
operation_->Move(src_path,
dest_path,
google_apis::test_util::CreateCopyResultCallback(&error));
content::RunAllBlockingPoolTasksUntilIdle();
EXPECT_EQ(FILE_ERROR_OK, error);
EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(dest_path, &dest_entry));
EXPECT_EQ(src_entry.local_id(), dest_entry.local_id());
EXPECT_EQ(ResourceEntry::DIRTY, dest_entry.metadata_edit_state());
EXPECT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntry(src_path, &src_entry));
EXPECT_EQ(2U, delegate()->get_changed_files().size());
EXPECT_TRUE(delegate()->get_changed_files().count(src_path));
EXPECT_TRUE(delegate()->get_changed_files().count(dest_path));
EXPECT_EQ(1U, delegate()->updated_local_ids().size());
EXPECT_TRUE(delegate()->updated_local_ids().count(src_entry.local_id()));
}
TEST_F(MoveOperationTest, MoveFileFromRootToSubDirectory) {
base::FilePath src_path(FILE_PATH_LITERAL("drive/root/File 1.txt"));
base::FilePath dest_path(
FILE_PATH_LITERAL("drive/root/Directory 1/Test.log"));
ResourceEntry src_entry, dest_entry;
ASSERT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(src_path, &src_entry));
ASSERT_EQ(FILE_ERROR_NOT_FOUND,
GetLocalResourceEntry(dest_path, &dest_entry));
FileError error = FILE_ERROR_FAILED;
operation_->Move(src_path,
dest_path,
google_apis::test_util::CreateCopyResultCallback(&error));
content::RunAllBlockingPoolTasksUntilIdle();
EXPECT_EQ(FILE_ERROR_OK, error);
EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(dest_path, &dest_entry));
EXPECT_EQ(src_entry.local_id(), dest_entry.local_id());
EXPECT_EQ(ResourceEntry::DIRTY, dest_entry.metadata_edit_state());
EXPECT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntry(src_path, &src_entry));
EXPECT_EQ(2U, delegate()->get_changed_files().size());
EXPECT_TRUE(delegate()->get_changed_files().count(src_path));
EXPECT_TRUE(delegate()->get_changed_files().count(dest_path));
EXPECT_EQ(1U, delegate()->updated_local_ids().size());
EXPECT_TRUE(delegate()->updated_local_ids().count(src_entry.local_id()));
}
TEST_F(MoveOperationTest, MoveNotExistingFile) {
base::FilePath src_path(FILE_PATH_LITERAL("drive/root/Dummy file.txt"));
base::FilePath dest_path(FILE_PATH_LITERAL("drive/root/Test.log"));
FileError error = FILE_ERROR_OK;
operation_->Move(src_path,
dest_path,
google_apis::test_util::CreateCopyResultCallback(&error));
content::RunAllBlockingPoolTasksUntilIdle();
EXPECT_EQ(FILE_ERROR_NOT_FOUND, error);
ResourceEntry entry;
EXPECT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntry(src_path, &entry));
EXPECT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntry(dest_path, &entry));
}
TEST_F(MoveOperationTest, MoveFileToNonExistingDirectory) {
base::FilePath src_path(FILE_PATH_LITERAL("drive/root/File 1.txt"));
base::FilePath dest_path(FILE_PATH_LITERAL("drive/root/Dummy/Test.log"));
FileError error = FILE_ERROR_OK;
operation_->Move(src_path,
dest_path,
google_apis::test_util::CreateCopyResultCallback(&error));
content::RunAllBlockingPoolTasksUntilIdle();
EXPECT_EQ(FILE_ERROR_NOT_FOUND, error);
ResourceEntry entry;
EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(src_path, &entry));
EXPECT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntry(dest_path, &entry));
}
// Test the case where the parent of |dest_file_path| is a existing file,
// not a directory.
TEST_F(MoveOperationTest, MoveFileToInvalidPath) {
base::FilePath src_path(FILE_PATH_LITERAL("drive/root/File 1.txt"));
base::FilePath dest_path(
FILE_PATH_LITERAL("drive/root/Duplicate Name.txt/Test.log"));
FileError error = FILE_ERROR_OK;
operation_->Move(src_path,
dest_path,
google_apis::test_util::CreateCopyResultCallback(&error));
content::RunAllBlockingPoolTasksUntilIdle();
EXPECT_EQ(FILE_ERROR_NOT_A_DIRECTORY, error);
ResourceEntry entry;
EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(src_path, &entry));
EXPECT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntry(dest_path, &entry));
}
} // namespace file_system
} // namespace drive
|
#include "settings.hpp"
#include "xyz/openbmc_project/Common/error.hpp"
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/exception.hpp>
namespace settings
{
PHOSPHOR_LOG2_USING;
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
constexpr auto mapperService = "xyz.openbmc_project.ObjectMapper";
constexpr auto mapperPath = "/xyz/openbmc_project/object_mapper";
constexpr auto mapperIntf = "xyz.openbmc_project.ObjectMapper";
Objects::Objects(sdbusplus::bus::bus& bus) : bus(bus)
{
std::vector<std::string> settingsIntfs = {autoRebootIntf, powerRestoreIntf};
auto depth = 0;
auto mapperCall = bus.new_method_call(mapperService, mapperPath, mapperIntf,
"GetSubTree");
mapperCall.append(root);
mapperCall.append(depth);
mapperCall.append(settingsIntfs);
using Interfaces = std::vector<Interface>;
using MapperResponse = std::map<Path, std::map<Service, Interfaces>>;
MapperResponse result;
try
{
auto response = bus.call(mapperCall);
response.read(result);
if (result.empty())
{
error("Invalid response from mapper");
elog<InternalFailure>();
}
}
catch (const sdbusplus::exception::exception& e)
{
error("Error in mapper GetSubTree: {ERROR}", "ERROR", e);
elog<InternalFailure>();
}
for (const auto& iter : result)
{
const Path& path = iter.first;
for (const auto& serviceIter : iter.second)
{
for (const auto& interface : serviceIter.second)
{
if (autoRebootIntf == interface)
{
/* There are two implementations of the AutoReboot
* Interface. A persistent user setting and a one-time
* setting which is only valid for one boot of the system.
* The one-time setting will have "one_time" in its
* object path.
*/
if (path.find("one_time") != std::string::npos)
{
autoRebootOneTime = path;
}
else
{
autoReboot = path;
}
}
else if (powerRestoreIntf == interface)
{
/* There are two implementations of the PowerRestorePolicy
* Interface. A persistent user setting and a one-time
* setting which is only valid for one boot of the system.
* The one-time setting will have "one_time" in its
* object path.
*/
if (path.find("one_time") != std::string::npos)
{
powerRestorePolicyOneTime = path;
}
else
{
powerRestorePolicy = path;
}
}
}
}
}
}
Service Objects::service(const Path& path, const Interface& interface) const
{
using Interfaces = std::vector<Interface>;
auto mapperCall =
bus.new_method_call(mapperService, mapperPath, mapperIntf, "GetObject");
mapperCall.append(path);
mapperCall.append(Interfaces({interface}));
std::map<Service, Interfaces> result;
try
{
auto response = bus.call(mapperCall);
response.read(result);
}
catch (const sdbusplus::exception::exception& e)
{
error("Error in mapper GetObject: {ERROR}", "ERROR", e);
elog<InternalFailure>();
}
if (result.empty())
{
error("Invalid response from mapper");
elog<InternalFailure>();
}
return result.begin()->first;
}
} // namespace settings
|
///////////////////////////////////////////////////////////////////////////////////////////
// INITIALIZE WINDOW AND HANDLE MAINLOOP
///////////////////////////////////////////////////////////////////////////////////////////
#include <windows.h>
#include <AvniInterfaces.h>
#include <ConfigurationManager.h>
#include <Singletons.h>
using namespace Avni;
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
int __stdcall WinMain(__in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in_opt LPSTR lpCmdLine, __in int nShowCmd)
{
MSG msg = { 0 };
WNDCLASS wc = { 0 };
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND);
wc.lpszClassName = "AVNI";
wc.style = CS_OWNDC;
if (!RegisterClass(&wc))
return 1;
HWND HWND = CreateWindowA(wc.lpszClassName, "AVNI", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 854, 480, 0, 0, hInstance, 0);
CONFIGURATIONMANAGER->SetHWND((void*)HWND);
CONFIGURATIONMANAGER->SetWindowed(true);
CONFIGURATIONMANAGER->Initialize(Config_WIN64_Directx11);
bool quit = false;
while (HWND != INVALID_HANDLE_VALUE && !quit)
{
if (PeekMessage(&msg, NULL, 0, 0,PM_REMOVE) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
quit = CONFIGURATIONMANAGER->Update() || CONFIGURATIONMANAGER->GetShouldQuit();
}
return 0;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_KEYDOWN:
{
//app->OnKeyDown(_WParam);
return 0;
}
case WM_DESTROY:
{
CONFIGURATIONMANAGER->SetShouldQuit(true);
PostQuitMessage(0);
return 0;
}
default:
{
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
return 0;
}
|
#include "prop.h"
/*
Static variables.
*/
std::vector <TEngine_Prop *>
TEngine_Prop::props
;
int
TEngine_Prop::free_id {-1}
;
/*
Functions.
*/
void TEngine_Prop::Set_Animation (sf::Texture * texture, unsigned max_frame, float change_time) /* public */
{
this -> prop_animation.texture = texture; /* prop animation setup */
this -> prop_animation.max_frame = max_frame - 1;
this -> prop_animation.current_frame = 0;
this -> prop_animation.change_time = change_time;
this -> prop_animation.total_time = 0;
this -> sprite_texture.width = this -> prop_animation.texture -> getSize ().x / max_frame; /* prop IntRect setup */
this -> sprite_texture.height = this -> prop_animation.texture -> getSize ().y;
sprite.setTexture (*this -> prop_animation.texture); /* setting prop texture */
}
void TEngine_Prop::Set_Position (float x, float y)
{
this -> sprite.setPosition (x, y);
std::cout << '[' << this -> id << "] prop new pos: [" << x << ", " << y << "]\n";
}
void TEngine_Prop::Anim (float & delta_time) /* private */
{
this -> prop_animation.total_time += delta_time; /* updating total time with delta time (time between frames)*/
if (this -> prop_animation.total_time >= this -> prop_animation.change_time)
{
this -> prop_animation.total_time -= this -> prop_animation.change_time; /* I'm not sure about this one */
if (this -> prop_animation.current_frame < this -> prop_animation.max_frame) /* Switching animation frame */
++(this -> prop_animation.current_frame);
else
this -> prop_animation.current_frame = 0;
}
switch (prop_direction) /* texture manipulation */
{
/*
add last_direction to avoid unnecessary actions on texture
*/
case Direction::Right:
this -> sprite_texture.left = this -> sprite_texture.width * this -> prop_animation.current_frame;
this -> sprite_texture.width = std::abs (this -> sprite_texture.width);
break;
case Direction::Left:
this -> sprite_texture.left = std::abs (this -> sprite_texture.width * (this -> prop_animation.current_frame + 1));
this -> sprite_texture.width = -std::abs (this -> sprite_texture.width);
break;
/* custom texture is needed for this */
case Direction::Up:
break;
case Direction::Down:
break;
}
sprite.setTextureRect (sprite_texture);
}
void TEngine_Prop::Draw (sf::RenderWindow & win, float & delta_time) /* public */
{
this -> Anim (delta_time);
win.draw (this -> sprite);
}
/*
Constructor & Deconstructor
*/
TEngine_Prop::TEngine_Prop () /* public */
{
if (TEngine_Prop::free_id != -1)
{
this -> id = TEngine_Prop::free_id;
TEngine_Prop::free_id = -1;
TEngine_Prop::props.push_back (this);
}
else
{
this -> id = TEngine_Prop::props.size ();
TEngine_Prop::props.push_back (this);
}
std::cout << "{+} Prop created. [" << this -> id << "]\n";
}
TEngine_Prop::~TEngine_Prop () /* public */
{
TEngine_Prop::props [this -> id] = nullptr;
TEngine_Prop::free_id = this -> id;
std::cout << "{-} Prop removed. [" << this -> id << "]\n";
}
|
#include "stdafx.h"
#include "lab6.h"
HINSTANCE hInst;
TCHAR* szTitle = _T("Some title");
TCHAR* szText = _T("Some text");
TCHAR* szWindowClass = _T("lab 6");
ATOM RegisterWindowClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPTSTR lpCmdLine,
_In_ int nCmdShow)
{
RegisterWindowClass(hInstance);
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) (msg.wParam);
}
ATOM RegisterWindowClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_LAB1);
wcex.lpszClassName = szWindowClass;
return RegisterClassEx(&wcex);
}
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
MoveWindow(hWnd, 0, 0, 320, 200,FALSE);
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
int textPosition = 0;
bool textRunning = FALSE;
void DoStart(HWND hWnd) {
if (!textRunning)
SetTimer(hWnd, 1, 3, NULL);
textRunning = TRUE;
}
void DoStop(HWND hWnd) {
if (textRunning)
KillTimer(hWnd, 1);
textRunning = FALSE;
}
void DoTimer(HWND hWnd) {
RECT rect;
GetWindowRect(hWnd, &rect);
textPosition += 1;
if (textPosition > rect.right - rect.left)
textPosition = -100;
InvalidateRect(hWnd, NULL, TRUE);
}
void DoPaint(HDC hdc) {
RECT rect;
SetTextColor(hdc, 0x00000000);
SetBkMode(hdc,TRANSPARENT);
rect.left = textPosition;
rect.top = 10;
rect.right = textPosition + 200;
rect.bottom = 100;
DrawText( hdc, szText, -1, &rect, DT_SINGLELINE | DT_NOCLIP ) ;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
switch (wmId)
{
case IDM_START:
DoStart(hWnd);
break;
case IDM_STOP:
DoStop(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_TIMER:
DoTimer(hWnd);
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
DoPaint(hdc);
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
|
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2004-2009 Kitware, Inc.
Copyright 2004 Alexander Neundorf (neundorf@kde.org)
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "cmExtraKateGenerator.h"
#include "cmGlobalUnixMakefileGenerator3.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmake.h"
#include "cmSourceFile.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include <cmsys/SystemTools.hxx>
//----------------------------------------------------------------------------
void cmExtraKateGenerator
::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const
{
entry.Name = this->GetName();
entry.Brief = "Generates Kate project files.";
}
cmExtraKateGenerator::cmExtraKateGenerator()
:cmExternalMakefileProjectGenerator()
{
#if defined(_WIN32)
this->SupportedGlobalGenerators.push_back("MinGW Makefiles");
this->SupportedGlobalGenerators.push_back("NMake Makefiles");
// disable until somebody actually tests it:
// this->SupportedGlobalGenerators.push_back("MSYS Makefiles");
#endif
this->SupportedGlobalGenerators.push_back("Ninja");
this->SupportedGlobalGenerators.push_back("Unix Makefiles");
}
void cmExtraKateGenerator::Generate()
{
cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
const cmMakefile* mf = lg->GetMakefile();
this->ProjectName = this->GenerateProjectName(lg->GetProjectName(),
mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
this->GetPathBasename(lg->GetBinaryDirectory()));
this->UseNinja = (this->GlobalGenerator->GetName() == "Ninja");
this->CreateKateProjectFile(lg);
this->CreateDummyKateProjectFile(lg);
}
void cmExtraKateGenerator::CreateKateProjectFile(
const cmLocalGenerator* lg) const
{
std::string filename = lg->GetBinaryDirectory();
filename += "/.kateproject";
cmGeneratedFileStream fout(filename.c_str());
if (!fout)
{
return;
}
fout <<
"{\n"
"\t\"name\": \"" << this->ProjectName << "\",\n"
"\t\"directory\": \"" << lg->GetSourceDirectory() << "\",\n"
"\t\"files\": [ { " << this->GenerateFilesString(lg) << "} ],\n";
this->WriteTargets(lg, fout);
fout << "}\n";
}
void
cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
cmGeneratedFileStream& fout) const
{
cmMakefile const* mf = lg->GetMakefile();
const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
const std::string makeArgs = mf->GetSafeDefinition(
"CMAKE_KATE_MAKE_ARGUMENTS");
const char* homeOutputDir = lg->GetBinaryDirectory();
fout <<
"\t\"build\": {\n"
"\t\t\"directory\": \"" << lg->GetBinaryDirectory() << "\",\n"
"\t\t\"default_target\": \"all\",\n"
"\t\t\"clean_target\": \"clean\",\n";
// build, clean and quick are for the build plugin kate <= 4.12:
fout << "\t\t\"build\": \"" << make << " -C \\\"" << homeOutputDir
<< "\\\" " << makeArgs << " " << "all\",\n";
fout << "\t\t\"clean\": \"" << make << " -C \\\"" << homeOutputDir
<< "\\\" " << makeArgs << " " << "clean\",\n";
fout << "\t\t\"quick\": \"" << make << " -C \\\"" << homeOutputDir
<< "\\\" " << makeArgs << " " << "install\",\n";
// this is for kate >= 4.13:
fout <<
"\t\t\"targets\":[\n";
this->AppendTarget(fout, "all", make, makeArgs,
homeOutputDir, homeOutputDir);
this->AppendTarget(fout, "clean", make, makeArgs,
homeOutputDir, homeOutputDir);
// add all executable and library targets and some of the GLOBAL
// and UTILITY targets
for (std::vector<cmLocalGenerator*>::const_iterator
it = this->GlobalGenerator->GetLocalGenerators().begin();
it != this->GlobalGenerator->GetLocalGenerators().end();
++it)
{
const std::vector<cmGeneratorTarget*> targets =
(*it)->GetGeneratorTargets();
std::string currentDir = (*it)->GetCurrentBinaryDirectory();
bool topLevel = (currentDir == (*it)->GetBinaryDirectory());
for(std::vector<cmGeneratorTarget*>::const_iterator ti =
targets.begin(); ti!=targets.end(); ++ti)
{
std::string targetName = (*ti)->GetName();
switch((*ti)->GetType())
{
case cmState::GLOBAL_TARGET:
{
bool insertTarget = false;
// Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs
if (topLevel)
{
insertTarget = true;
// only add the "edit_cache" target if it's not ccmake, because
// this will not work within the IDE
if (targetName == "edit_cache")
{
const char* editCommand = (*it)->GetMakefile()->GetDefinition
("CMAKE_EDIT_COMMAND");
if (editCommand == 0)
{
insertTarget = false;
}
else if (strstr(editCommand, "ccmake")!=NULL)
{
insertTarget = false;
}
}
}
if (insertTarget)
{
this->AppendTarget(fout, targetName, make, makeArgs,
currentDir, homeOutputDir);
}
}
break;
case cmState::UTILITY:
// Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart
if (((targetName.find("Nightly")==0) &&(targetName!="Nightly"))
|| ((targetName.find("Continuous")==0)
&&(targetName!="Continuous"))
|| ((targetName.find("Experimental")==0)
&& (targetName!="Experimental")))
{
break;
}
this->AppendTarget(fout, targetName, make, makeArgs,
currentDir, homeOutputDir);
break;
case cmState::EXECUTABLE:
case cmState::STATIC_LIBRARY:
case cmState::SHARED_LIBRARY:
case cmState::MODULE_LIBRARY:
case cmState::OBJECT_LIBRARY:
{
this->AppendTarget(fout, targetName, make, makeArgs,
currentDir, homeOutputDir);
std::string fastTarget = targetName;
fastTarget += "/fast";
this->AppendTarget(fout, fastTarget, make, makeArgs,
currentDir, homeOutputDir);
}
break;
default:
break;
}
}
//insert rules for compiling, preprocessing and assembling individual files
std::vector<std::string> objectFileTargets;
(*it)->GetIndividualFileTargets(objectFileTargets);
for(std::vector<std::string>::const_iterator fit=objectFileTargets.begin();
fit != objectFileTargets.end();
++fit)
{
this->AppendTarget(fout, *fit, make, makeArgs, currentDir,homeOutputDir);
}
}
fout <<
"\t] }\n";
}
void
cmExtraKateGenerator::AppendTarget(cmGeneratedFileStream& fout,
const std::string& target,
const std::string& make,
const std::string& makeArgs,
const std::string& path,
const char* homeOutputDir
) const
{
static char JsonSep = ' ';
fout <<
"\t\t\t" << JsonSep << "{\"name\":\"" << target << "\", "
"\"build_cmd\":\"" << make
<< " -C \\\"" << (this->UseNinja ? homeOutputDir : path.c_str())
<< "\\\" " << makeArgs << " "
<< target << "\"}\n";
JsonSep = ',';
}
void
cmExtraKateGenerator::CreateDummyKateProjectFile(
const cmLocalGenerator* lg) const
{
std::string filename = lg->GetBinaryDirectory();
filename += "/";
filename += this->ProjectName;
filename += ".kateproject";
cmGeneratedFileStream fout(filename.c_str());
if (!fout)
{
return;
}
fout << "#Generated by " << cmSystemTools::GetCMakeCommand()
<< ", do not edit.\n";
}
std::string
cmExtraKateGenerator::GenerateFilesString(const cmLocalGenerator* lg) const
{
std::string s = lg->GetSourceDirectory();
s += "/.git";
if(cmSystemTools::FileExists(s.c_str()))
{
return std::string("\"git\": 1 ");
}
s = lg->GetSourceDirectory();
s += "/.svn";
if(cmSystemTools::FileExists(s.c_str()))
{
return std::string("\"svn\": 1 ");
}
s = lg->GetSourceDirectory();
s += "/";
std::set<std::string> files;
std::string tmp;
const std::vector<cmLocalGenerator *>& lgs =
this->GlobalGenerator->GetLocalGenerators();
for (std::vector<cmLocalGenerator*>::const_iterator it=lgs.begin();
it!=lgs.end(); it++)
{
cmMakefile* makefile=(*it)->GetMakefile();
const std::vector<std::string>& listFiles=makefile->GetListFiles();
for (std::vector<std::string>::const_iterator lt=listFiles.begin();
lt!=listFiles.end(); lt++)
{
tmp=*lt;
{
files.insert(tmp);
}
}
const std::vector<cmSourceFile*>& sources = makefile->GetSourceFiles();
for (std::vector<cmSourceFile*>::const_iterator sfIt = sources.begin();
sfIt != sources.end(); sfIt++)
{
cmSourceFile* sf = *sfIt;
if (sf->GetPropertyAsBool("GENERATED"))
{
continue;
}
tmp = sf->GetFullPath();
files.insert(tmp);
}
}
const char* sep = "";
tmp = "\"list\": [";
for(std::set<std::string>::const_iterator it = files.begin();
it != files.end(); ++it)
{
tmp += sep;
tmp += " \"";
tmp += *it;
tmp += "\"";
sep = ",";
}
tmp += "] ";
return tmp;
}
std::string cmExtraKateGenerator::GenerateProjectName(const std::string& name,
const std::string& type,
const std::string& path) const
{
return name + (type.empty() ? "" : "-") + type + "@" + path;
}
std::string cmExtraKateGenerator::GetPathBasename(const std::string& path)const
{
std::string outputBasename = path;
while (!outputBasename.empty() &&
(outputBasename[outputBasename.size() - 1] == '/' ||
outputBasename[outputBasename.size() - 1] == '\\'))
{
outputBasename.resize(outputBasename.size() - 1);
}
std::string::size_type loc = outputBasename.find_last_of("/\\");
if (loc != std::string::npos)
{
outputBasename = outputBasename.substr(loc + 1);
}
return outputBasename;
}
|
// Copyright (c) 2013-2018 mogemimi. Distributed under the MIT license.
#pragma once
#include "Pomdog/Basic/Export.hpp"
#include "Pomdog/Graphics/detail/ForwardDeclarations.hpp"
#include <cstdlib>
#include <memory>
namespace Pomdog {
class GraphicsCommandList;
class POMDOG_EXPORT GraphicsCommandQueue final {
public:
GraphicsCommandQueue() = delete;
GraphicsCommandQueue(const GraphicsCommandQueue&) = delete;
GraphicsCommandQueue& operator=(const GraphicsCommandQueue&) = delete;
explicit GraphicsCommandQueue(
std::unique_ptr<Detail::NativeGraphicsCommandQueue>&& nativeCommandQueue);
std::size_t GetCommandCount() const noexcept;
void Reset();
void PushbackCommandList(const std::shared_ptr<GraphicsCommandList>& commandList);
void ExecuteCommandLists();
void Present();
private:
std::unique_ptr<Detail::NativeGraphicsCommandQueue> nativeCommandQueue;
};
} // namespace Pomdog
|
#ifndef GBCPP_MEMORY_H
#define GBCPP_MEMORY_H
#include "common/common.hpp"
#include <cstdlib>
#include <cstdio>
class memory {
private:
byte* _memory;
int _size;
public:
explicit memory(int size);
memory() = delete;
~memory();
byte& operator[](int index);
};
#endif
|
//==================================================================================================
/*
EVE - Expressive Vector Engine
Copyright : EVE Contributors & Maintainers
SPDX-License-Identifier: MIT
*/
//==================================================================================================
#include <eve/function/frexp.hpp>
#include <eve/constant/valmin.hpp>
#include <eve/constant/valmax.hpp>
#include <cmath>
int main()
{
auto lmin = eve::valmin(eve::as<EVE_VALUE>());
auto lmax = eve::valmax(eve::as<EVE_VALUE>());
auto arg0 = eve::bench::random_<EVE_VALUE>(lmin,lmax);
eve::bench::experiment xp;
run<EVE_VALUE> (EVE_NAME(raw(eve::frexp)) , xp, eve::raw(eve::frexp), arg0);
run<EVE_TYPE> (EVE_NAME(raw(eve::frexp)) , xp, eve::raw(eve::frexp), arg0);
}
|
#ifndef __BOARD_CONFIG_HPP__
#define __BOARD_CONFIG_HPP__
#define BUTTON_L 38
#define BUTTON_M 37
#define BUTTON_R 39
#if defined (TTGO_T4_V12) || (TTGO_T4_V13)
#define TFT_CS 27
#define TFT_MOSI 23
#define TFT_CLK 18
#define TFT_RST 5
#define TFT_MISO 12
#define TFT_BL 4 // GPIO not managed by library
#endif
#ifdef TTGO_TM
#define TFT_CS 5
#define TFT_DC 16
#define TFT_MOSI 23
#define TFT_CLK 18
#define TFT_RST 17
#define TFT_MISO -1
#define TFT_BL 4 // GPIO not managed by library
#endif
#ifdef TTGO_T4_V12
#define TFT_DC 26
#endif
#ifdef TTGO_T4_V13
#define TFT_DC 32
#endif
#endif
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkTransformFeedback.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkTransformFeedback.h"
#include "vtkObjectFactory.h"
#include "vtkOpenGLBufferObject.h"
#include "vtkOpenGLError.h"
#include "vtkShaderProgram.h"
#include "vtk_glew.h"
vtkStandardNewMacro(vtkTransformFeedback);
//------------------------------------------------------------------------------
void vtkTransformFeedback::PrintSelf(std::ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
}
//------------------------------------------------------------------------------
size_t vtkTransformFeedback::GetBytesPerVertex() const
{
size_t result = 0;
typedef std::vector<VaryingMetaData>::const_iterator IterT;
for (IterT it = this->Varyings.begin(), itEnd = this->Varyings.end(); it != itEnd; ++it)
{
result += this->GetBytesPerVertex(it->Role);
}
return result;
}
//------------------------------------------------------------------------------
void vtkTransformFeedback::ClearVaryings()
{
this->Varyings.clear();
this->VaryingsBound = false;
}
//------------------------------------------------------------------------------
void vtkTransformFeedback::AddVarying(VaryingRole role, const std::string& var)
{
this->Varyings.emplace_back(role, var);
this->VaryingsBound = false;
}
//------------------------------------------------------------------------------
void vtkTransformFeedback::SetNumberOfVertices(int drawMode, size_t inputVerts)
{
switch (static_cast<GLenum>(drawMode))
{
case GL_POINTS:
this->SetNumberOfVertices(inputVerts);
this->SetPrimitiveMode(GL_POINTS);
return;
case GL_LINE_STRIP:
this->SetNumberOfVertices(inputVerts < 2 ? 0 : (2 * (inputVerts - 1)));
this->SetPrimitiveMode(GL_LINES);
return;
case GL_LINE_LOOP:
this->SetNumberOfVertices(2 * inputVerts);
this->SetPrimitiveMode(GL_LINES);
return;
case GL_LINES:
this->SetNumberOfVertices(inputVerts);
this->SetPrimitiveMode(GL_LINES);
return;
case GL_TRIANGLE_STRIP:
this->SetNumberOfVertices(inputVerts < 3 ? 0 : (3 * (inputVerts - 2)));
this->SetPrimitiveMode(GL_TRIANGLES);
return;
case GL_TRIANGLE_FAN:
this->SetNumberOfVertices(inputVerts < 3 ? 0 : (3 * (inputVerts - 2)));
this->SetPrimitiveMode(GL_TRIANGLES);
return;
case GL_TRIANGLES:
this->SetNumberOfVertices(inputVerts);
this->SetPrimitiveMode(GL_TRIANGLES);
return;
}
vtkErrorMacro("Unknown draw mode enum value: " << drawMode);
this->SetNumberOfVertices(0);
this->SetPrimitiveMode(GL_POINTS);
}
//------------------------------------------------------------------------------
size_t vtkTransformFeedback::GetBufferSize() const
{
return this->GetBytesPerVertex() * this->NumberOfVertices;
}
//------------------------------------------------------------------------------
void vtkTransformFeedback::BindVaryings(vtkShaderProgram* prog)
{
if (this->Varyings.empty())
{
vtkErrorMacro(<< "No capture varyings specified.");
return;
}
vtkOpenGLClearErrorMacro();
std::vector<const char*> vars;
vars.reserve(this->Varyings.size());
for (size_t i = 0; i < this->Varyings.size(); ++i)
{
vars.push_back(this->Varyings[i].Identifier.c_str());
}
glTransformFeedbackVaryings(static_cast<GLuint>(prog->GetHandle()),
static_cast<GLsizei>(vars.size()), &vars[0], static_cast<GLenum>(this->BufferMode));
this->VaryingsBound = true;
vtkOpenGLCheckErrorMacro("OpenGL errors detected after "
"glTransformFeedbackVaryings.");
}
//------------------------------------------------------------------------------
void vtkTransformFeedback::Allocate(int nbBuffers, size_t size, unsigned int hint)
{
vtkOpenGLClearErrorMacro();
this->ReleaseGraphicsResources();
this->Buffers.resize(nbBuffers);
for (int i = 0; i < nbBuffers; i++)
{
this->Buffers[i] = vtkOpenGLBufferObject::New();
this->Buffers[i]->GenerateBuffer(vtkOpenGLBufferObject::ArrayBuffer);
glBindBuffer(GL_ARRAY_BUFFER, this->Buffers[i]->GetHandle());
glBufferData(
GL_ARRAY_BUFFER, static_cast<GLsizeiptr>(size), nullptr, static_cast<GLenum>(hint));
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, i, this->Buffers[i]->GetHandle());
}
}
//------------------------------------------------------------------------------
void vtkTransformFeedback::BindBuffer(bool allocateOneBuffer)
{
if (!this->VaryingsBound)
{
vtkErrorMacro("Varyings not yet bound!");
return;
}
vtkOpenGLClearErrorMacro();
if (allocateOneBuffer)
{
this->Allocate(1, this->GetBufferSize(), GL_STATIC_READ);
}
for (size_t i = 0; i < this->Buffers.size(); i++)
{
glBindBufferBase(
GL_TRANSFORM_FEEDBACK_BUFFER, static_cast<GLuint>(i), this->Buffers[i]->GetHandle());
}
glBeginTransformFeedback(static_cast<GLenum>(this->PrimitiveMode));
vtkOpenGLCheckErrorMacro("OpenGL errors detected.");
}
//------------------------------------------------------------------------------
void vtkTransformFeedback::ReadBuffer(int index)
{
if (this->Buffers.empty())
{
vtkErrorMacro("Buffers not set by BindBuffer().");
return;
}
glEndTransformFeedback();
if (index >= 0)
{
size_t bufferSize = this->GetBufferSize();
this->ReleaseBufferData();
this->BufferData = new unsigned char[bufferSize];
unsigned char* glBuffer(nullptr);
glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, this->Buffers[index]->GetHandle());
glMapBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, bufferSize, GL_MAP_READ_BIT);
glGetBufferPointerv(
GL_TRANSFORM_FEEDBACK_BUFFER, GL_BUFFER_MAP_POINTER, reinterpret_cast<GLvoid**>(&glBuffer));
std::copy(glBuffer, glBuffer + bufferSize, this->BufferData);
glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);
}
vtkOpenGLCheckErrorMacro("OpenGL errors detected.");
}
//------------------------------------------------------------------------------
vtkOpenGLBufferObject* vtkTransformFeedback::GetBuffer(int index)
{
return this->Buffers[index];
}
//------------------------------------------------------------------------------
int vtkTransformFeedback::GetBufferHandle(int index)
{
return this->Buffers[index]->GetHandle();
}
//------------------------------------------------------------------------------
void vtkTransformFeedback::ReleaseGraphicsResources()
{
if (!this->Buffers.empty())
{
for (auto v : this->Buffers)
{
v->ReleaseGraphicsResources();
v->Delete();
}
this->Buffers.clear();
}
}
//------------------------------------------------------------------------------
void vtkTransformFeedback::ReleaseBufferData(bool freeBuffer)
{
if (freeBuffer)
{
delete[] this->BufferData;
}
this->BufferData = nullptr;
}
//------------------------------------------------------------------------------
vtkTransformFeedback::vtkTransformFeedback()
: VaryingsBound(false)
, NumberOfVertices(0)
, BufferMode(GL_INTERLEAVED_ATTRIBS)
, PrimitiveMode(GL_POINTS)
, BufferData(nullptr)
{
}
//------------------------------------------------------------------------------
vtkTransformFeedback::~vtkTransformFeedback()
{
this->ReleaseGraphicsResources();
this->ReleaseBufferData();
}
|
/* Unit testing for outcomes
(C) 2013-2020 Niall Douglas <http://www.nedproductions.biz/> (5 commits)
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <boost/outcome/outcome.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/test/unit_test_monitor.hpp>
BOOST_OUTCOME_AUTO_TEST_CASE(issues_0012_test, "outcome's copy assignment gets instantiated even when type T cannot be copied")
{
using namespace BOOST_OUTCOME_V2_NAMESPACE;
const char *s = "hi";
struct udt // NOLINT
{
const char *_v{nullptr};
udt() = default;
constexpr explicit udt(const char *v) noexcept : _v(v) {}
constexpr udt(udt &&o) noexcept : _v(o._v) { o._v = nullptr; }
udt(const udt &) = delete;
constexpr udt &operator=(udt &&o) noexcept
{
_v = o._v;
o._v = nullptr;
return *this;
}
udt &operator=(const udt &) = delete;
constexpr const char *operator*() const noexcept { return _v; }
};
static_assert(std::is_move_constructible<outcome<udt>>::value, "expected<udt> is not move constructible!");
static_assert(!std::is_copy_constructible<outcome<udt>>::value, "expected<udt> is copy constructible!");
outcome<udt> p(udt{s}), n(boost::system::error_code(ENOMEM, boost::system::generic_category()));
n = boost::system::error_code(EINVAL, boost::system::generic_category());
BOOST_CHECK(n.error().value() == EINVAL);
}
|
// Copyright (c) 2013 Thomas Heller
// Copyright (c) 2018 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <hpx/config.hpp>
#include <hpx/hpx.hpp>
#include <hpx/hpx_main.hpp>
#include <hpx/include/lcos_local.hpp>
#include <hpx/include/threads.hpp>
#include <hpx/modules/testing.hpp>
#include <hpx/pack_traversal/unwrap.hpp>
#include <atomic>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <memory>
#include <string>
#include <utility>
#include <vector>
///////////////////////////////////////////////////////////////////////////////
#include <boost/container/small_vector.hpp>
namespace hpx { namespace traits {
// support unwrapping of boost::container::small_vector
// Note: small_vector's allocator support is not 100% conforming
template <typename NewType, typename OldType, std::size_t Size,
typename OldAllocator>
struct pack_traversal_rebind_container<NewType,
boost::container::small_vector<OldType, Size, OldAllocator>>
{
using NewAllocator = typename std::allocator_traits<
OldAllocator>::template rebind_alloc<NewType>;
static boost::container::small_vector<NewType, Size, NewAllocator> call(
boost::container::small_vector<OldType, Size, OldAllocator> const&)
{
// Create a new version of the container with a new allocator
// instance
return boost::container::small_vector<NewType, Size,
NewAllocator>();
}
};
}} // namespace hpx::traits
template <typename T>
using small_vector =
boost::container::small_vector<T, 3, boost::container::new_allocator<T>>;
///////////////////////////////////////////////////////////////////////////////
std::atomic<std::uint32_t> void_f_count;
std::atomic<std::uint32_t> int_f_count;
void void_f()
{
++void_f_count;
}
int int_f()
{
++int_f_count;
return 42;
}
std::atomic<std::uint32_t> void_f1_count;
std::atomic<std::uint32_t> int_f1_count;
void void_f1(int)
{
++void_f1_count;
}
int int_f1(int i)
{
++int_f1_count;
return i + 42;
}
std::atomic<std::uint32_t> int_f2_count;
int int_f2(int l, int r)
{
++int_f2_count;
return l + r;
}
std::atomic<std::uint32_t> int_f_vector_count;
int int_f_vector(small_vector<int> const& vf)
{
int sum = 0;
for (int f : vf)
{
sum += f;
}
return sum;
}
void function_pointers(std::uint32_t num)
{
void_f_count.store(0);
int_f_count.store(0);
void_f1_count.store(0);
int_f1_count.store(0);
int_f2_count.store(0);
hpx::future<void> f1 =
hpx::dataflow(hpx::util::unwrapping(&void_f1), hpx::async(&int_f));
hpx::future<int> f2 = hpx::dataflow(hpx::util::unwrapping(&int_f1),
hpx::dataflow(
hpx::util::unwrapping(&int_f1), hpx::make_ready_future(42)));
hpx::future<int> f3 = hpx::dataflow(hpx::util::unwrapping(&int_f2),
hpx::dataflow(
hpx::util::unwrapping(&int_f1), hpx::make_ready_future(42)),
hpx::dataflow(
hpx::util::unwrapping(&int_f1), hpx::make_ready_future(37)));
int_f_vector_count.store(0);
small_vector<hpx::future<int>> vf;
vf.resize(num);
for (std::uint32_t i = 0; i < num; ++i)
{
vf[i] = hpx::dataflow(
hpx::util::unwrapping(&int_f1), hpx::make_ready_future(42));
}
hpx::future<int> f4 =
hpx::dataflow(hpx::util::unwrapping(&int_f_vector), std::move(vf));
hpx::future<int> f5 = hpx::dataflow(hpx::util::unwrapping(&int_f1),
hpx::dataflow(
hpx::util::unwrapping(&int_f1), hpx::make_ready_future(42)),
hpx::dataflow(
hpx::util::unwrapping(&void_f), hpx::make_ready_future()));
f1.wait();
HPX_TEST_EQ(f2.get(), 126);
HPX_TEST_EQ(f3.get(), 163);
HPX_TEST_EQ(f4.get(), int(num * 84));
HPX_TEST_EQ(f5.get(), 126);
HPX_TEST_EQ(void_f_count, 1u);
HPX_TEST_EQ(int_f_count, 1u);
HPX_TEST_EQ(void_f1_count, 1u);
HPX_TEST_EQ(int_f1_count, 6u + num);
HPX_TEST_EQ(int_f2_count, 1u);
}
///////////////////////////////////////////////////////////////////////////////
std::atomic<std::uint32_t> future_void_f1_count;
std::atomic<std::uint32_t> future_void_f2_count;
void future_void_f1(hpx::future<void> f1)
{
HPX_TEST(f1.is_ready());
++future_void_f1_count;
}
void future_void_sf1(hpx::shared_future<void> f1)
{
HPX_TEST(f1.is_ready());
++future_void_f1_count;
}
void future_void_f2(hpx::future<void> f1, hpx::future<void> f2)
{
HPX_TEST(f1.is_ready());
HPX_TEST(f2.is_ready());
++future_void_f2_count;
}
std::atomic<std::uint32_t> future_int_f1_count;
int future_int_f1(hpx::future<void> f1)
{
HPX_TEST(f1.is_ready());
++future_int_f1_count;
return 1;
}
std::atomic<std::uint32_t> future_int_f_vector_count;
int future_int_f_vector(small_vector<hpx::future<int>>& vf)
{
++future_int_f_vector_count;
int sum = 0;
for (hpx::future<int>& f : vf)
{
HPX_TEST(f.is_ready());
sum += f.get();
}
return sum;
}
void future_function_pointers(std::uint32_t num)
{
future_int_f1_count.store(0);
future_int_f_vector_count.store(0);
future_int_f_vector_count.store(0);
small_vector<hpx::future<int>> vf;
vf.resize(num);
for (std::uint32_t i = 0; i < num; ++i)
{
vf[i] = hpx::dataflow(&future_int_f1, hpx::make_ready_future());
}
hpx::future<int> f5 = hpx::dataflow(&future_int_f_vector, std::ref(vf));
HPX_TEST_EQ(f5.get(), int(num));
HPX_TEST_EQ(future_int_f1_count, num);
HPX_TEST_EQ(future_int_f_vector_count, 1u);
}
///////////////////////////////////////////////////////////////////////////////
int main()
{
function_pointers(3);
function_pointers(3);
future_function_pointers(10);
future_function_pointers(10);
return hpx::util::report_errors();
}
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include "build/build_config.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/ui/browser_command_controller.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/testing_profile.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/test/bookmark_test_helpers.h"
#include "components/zoom/page_zoom.h"
#include "components/zoom/zoom_controller.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/page_zoom.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_renderer_host.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/page/page_zoom.h"
#include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h"
namespace {
using bookmarks::BookmarkModel;
using content::OpenURLParams;
using content::Referrer;
using content::WebContents;
using zoom::ZoomController;
class BrowserCommandsTest : public BrowserWithTestWindowTest {
public:
BrowserCommandsTest() = default;
~BrowserCommandsTest() override = default;
// BrowserWithTestWindowTest overrides.
TestingProfile::TestingFactories GetTestingFactories() override {
return {{BookmarkModelFactory::GetInstance(),
BookmarkModelFactory::GetDefaultFactory()}};
}
};
// Tests IDC_SELECT_TAB_0, IDC_SELECT_NEXT_TAB, IDC_SELECT_PREVIOUS_TAB and
// IDC_SELECT_LAST_TAB.
TEST_F(BrowserCommandsTest, TabNavigationAccelerators) {
GURL about_blank(url::kAboutBlankURL);
// Create three tabs.
AddTab(browser(), about_blank);
AddTab(browser(), about_blank);
AddTab(browser(), about_blank);
// Select the second tab.
browser()->tab_strip_model()->ActivateTabAt(1);
CommandUpdater* updater = browser()->command_controller();
// Navigate to the first tab using an accelerator.
updater->ExecuteCommand(IDC_SELECT_TAB_0);
ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
// Navigate to the second tab using the next accelerators.
updater->ExecuteCommand(IDC_SELECT_NEXT_TAB);
ASSERT_EQ(1, browser()->tab_strip_model()->active_index());
// Navigate back to the first tab using the previous accelerators.
updater->ExecuteCommand(IDC_SELECT_PREVIOUS_TAB);
ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
// Navigate to the last tab using the select last accelerator.
updater->ExecuteCommand(IDC_SELECT_LAST_TAB);
ASSERT_EQ(2, browser()->tab_strip_model()->active_index());
}
// Tests IDC_DUPLICATE_TAB.
TEST_F(BrowserCommandsTest, DuplicateTab) {
GURL url1("http://foo/1");
GURL url2("http://foo/2");
GURL url3("http://foo/3");
GURL url4("http://foo/4");
// Navigate to three urls, plus a pending URL that hasn't committed.
AddTab(browser(), url1);
NavigateAndCommitActiveTab(url2);
NavigateAndCommitActiveTab(url3);
content::NavigationController& orig_controller =
browser()->tab_strip_model()->GetWebContentsAt(0)->GetController();
orig_controller.LoadURL(
url4, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string());
EXPECT_EQ(3, orig_controller.GetEntryCount());
EXPECT_TRUE(orig_controller.GetPendingEntry());
size_t initial_window_count = chrome::GetTotalBrowserCount();
// Duplicate the tab.
chrome::ExecuteCommand(browser(), IDC_DUPLICATE_TAB);
// The duplicated tab should not end up in a new window.
size_t window_count = chrome::GetTotalBrowserCount();
ASSERT_EQ(initial_window_count, window_count);
// And we should have a newly duplicated tab.
ASSERT_EQ(2, browser()->tab_strip_model()->count());
// Verify the stack of urls.
content::NavigationController& controller =
browser()->tab_strip_model()->GetWebContentsAt(1)->GetController();
EXPECT_EQ(3, controller.GetEntryCount());
EXPECT_EQ(2, controller.GetCurrentEntryIndex());
EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL());
EXPECT_EQ(url2, controller.GetEntryAtIndex(1)->GetURL());
EXPECT_EQ(url3, controller.GetEntryAtIndex(2)->GetURL());
EXPECT_FALSE(controller.GetPendingEntry());
}
// Tests IDC_VIEW_SOURCE (See http://crbug.com/138140).
TEST_F(BrowserCommandsTest, ViewSource) {
GURL url1("http://foo/1");
GURL url1_subframe("http://foo/subframe");
GURL url2("http://foo/2");
// Navigate to a URL and simulate a subframe committing.
AddTab(browser(), url1);
content::RenderFrameHostTester* rfh_tester =
content::RenderFrameHostTester::For(
browser()->tab_strip_model()->GetWebContentsAt(0)->GetMainFrame());
content::RenderFrameHost* subframe = rfh_tester->AppendChild("subframe");
content::NavigationSimulator::NavigateAndCommitFromDocument(
GURL(url1_subframe), subframe);
// Now start a pending navigation that hasn't committed.
content::NavigationController& orig_controller =
browser()->tab_strip_model()->GetWebContentsAt(0)->GetController();
orig_controller.LoadURL(
url2, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string());
EXPECT_EQ(1, orig_controller.GetEntryCount());
EXPECT_TRUE(orig_controller.GetPendingEntry());
size_t initial_window_count = chrome::GetTotalBrowserCount();
// View Source.
chrome::ExecuteCommand(browser(), IDC_VIEW_SOURCE);
// The view source tab should not end up in a new window.
size_t window_count = chrome::GetTotalBrowserCount();
ASSERT_EQ(initial_window_count, window_count);
// And we should have a newly duplicated tab.
ASSERT_EQ(2, browser()->tab_strip_model()->count());
// Verify we are viewing the source of the last committed entry.
GURL view_source_url("view-source:http://foo/1");
content::NavigationController& controller =
browser()->tab_strip_model()->GetWebContentsAt(1)->GetController();
EXPECT_EQ(1, controller.GetEntryCount());
EXPECT_EQ(0, controller.GetCurrentEntryIndex());
EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL());
EXPECT_EQ(view_source_url, controller.GetEntryAtIndex(0)->GetVirtualURL());
EXPECT_FALSE(controller.GetPendingEntry());
}
TEST_F(BrowserCommandsTest, BookmarkCurrentTab) {
BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
bookmarks::test::WaitForBookmarkModelToLoad(model);
// Navigate to a url.
GURL url1("http://foo/1");
AddTab(browser(), url1);
browser()->OpenURL(OpenURLParams(url1, Referrer(),
WindowOpenDisposition::CURRENT_TAB,
ui::PAGE_TRANSITION_TYPED, false));
chrome::BookmarkCurrentTab(browser());
// It should now be bookmarked in the bookmark model.
EXPECT_EQ(profile(), browser()->profile());
EXPECT_TRUE(model->IsBookmarked(url1));
}
// Tests back/forward in new tab (Control + Back/Forward button in the UI).
TEST_F(BrowserCommandsTest, BackForwardInNewTab) {
GURL url1("http://foo/1");
GURL url2("http://foo/2");
// Make a tab with the two pages navigated in it.
AddTab(browser(), url1);
NavigateAndCommitActiveTab(url2);
// Go back in a new background tab.
chrome::GoBack(browser(), WindowOpenDisposition::NEW_BACKGROUND_TAB);
EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
ASSERT_EQ(2, browser()->tab_strip_model()->count());
WebContents* zeroth = browser()->tab_strip_model()->GetWebContentsAt(0);
WebContents* first = browser()->tab_strip_model()->GetWebContentsAt(1);
// The original tab should be unchanged.
EXPECT_EQ(url2, zeroth->GetLastCommittedURL());
EXPECT_TRUE(zeroth->GetController().CanGoBack());
EXPECT_FALSE(zeroth->GetController().CanGoForward());
// The new tab should be like the first one but navigated back. Since we
// didn't wait for the load to complete, we can't use GetLastCommittedURL.
EXPECT_EQ(url1, first->GetVisibleURL());
EXPECT_FALSE(first->GetController().CanGoBack());
EXPECT_TRUE(first->GetController().CanGoForward());
// Select the second tab and make it go forward in a new background tab.
browser()->tab_strip_model()->ActivateTabAt(
1, {TabStripModel::GestureType::kOther});
// TODO(crbug.com/11055): It should not be necessary to commit the load here,
// but because of this bug, it will assert later if we don't. When the bug is
// fixed, one of the three commits here related to this bug should be removed
// (to test both codepaths).
CommitPendingLoad(&first->GetController());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
chrome::GoForward(browser(), WindowOpenDisposition::NEW_BACKGROUND_TAB);
// The previous tab should be unchanged and still in the foreground.
EXPECT_EQ(url1, first->GetLastCommittedURL());
EXPECT_FALSE(first->GetController().CanGoBack());
EXPECT_TRUE(first->GetController().CanGoForward());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
// There should be a new tab navigated forward.
ASSERT_EQ(3, browser()->tab_strip_model()->count());
WebContents* second = browser()->tab_strip_model()->GetWebContentsAt(2);
// Since we didn't wait for load to complete, we can't use
// GetLastCommittedURL.
EXPECT_EQ(url2, second->GetVisibleURL());
EXPECT_TRUE(second->GetController().CanGoBack());
EXPECT_FALSE(second->GetController().CanGoForward());
// Now do back in a new foreground tab. Don't bother re-checking every sngle
// thing above, just validate that it's opening properly.
browser()->tab_strip_model()->ActivateTabAt(
2, {TabStripModel::GestureType::kOther});
// TODO(crbug.com/11055): see the comment above about why we need this.
CommitPendingLoad(&second->GetController());
chrome::GoBack(browser(), WindowOpenDisposition::NEW_FOREGROUND_TAB);
ASSERT_EQ(3, browser()->tab_strip_model()->active_index());
ASSERT_EQ(url1,
browser()->tab_strip_model()->GetActiveWebContents()->
GetVisibleURL());
// Same thing again for forward.
// TODO(crbug.com/11055): see the comment above about why we need this.
CommitPendingLoad(&
browser()->tab_strip_model()->GetActiveWebContents()->GetController());
chrome::GoForward(browser(), WindowOpenDisposition::NEW_FOREGROUND_TAB);
ASSERT_EQ(4, browser()->tab_strip_model()->active_index());
ASSERT_EQ(url2,
browser()->tab_strip_model()->GetActiveWebContents()->
GetVisibleURL());
}
// Tests back/forward in new tab (Control + Back/Forward button in the UI)
// with Tab Groups enabled.
TEST_F(BrowserCommandsTest, BackForwardInNewTabWithGroup) {
GURL url1("http://foo/1");
GURL url2("http://foo/2");
// Make a tab with the two pages navigated in it.
AddTab(browser(), url1);
NavigateAndCommitActiveTab(url2);
// Add the tab to a Tab Group.
const tab_groups::TabGroupId group_id =
browser()->tab_strip_model()->AddToNewGroup({0});
// Go back in a new background tab.
chrome::GoBack(browser(), WindowOpenDisposition::NEW_BACKGROUND_TAB);
ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
ASSERT_EQ(2, browser()->tab_strip_model()->count());
// The new tab should have inherited the tab group from the old tab.
EXPECT_EQ(group_id, browser()->tab_strip_model()->GetTabGroupForTab(1));
// Select the second tab and make it go forward in a new background tab.
browser()->tab_strip_model()->ActivateTabAt(
1, {TabStripModel::GestureType::kOther});
// TODO(crbug.com/11055): see the comment above about why we need this.
CommitPendingLoad(
&browser()->tab_strip_model()->GetActiveWebContents()->GetController());
chrome::GoForward(browser(), WindowOpenDisposition::NEW_BACKGROUND_TAB);
// The new tab should have inherited the tab group from the old tab.
EXPECT_EQ(group_id, browser()->tab_strip_model()->GetTabGroupForTab(2));
}
TEST_F(BrowserCommandsTest, OnMaxZoomIn) {
TabStripModel* tab_strip_model = browser()->tab_strip_model();
GURL url("http://www.google.com");
AddTab(browser(), url);
WebContents* first_tab = tab_strip_model->GetWebContentsAt(0);
// Continue to zoom in until zoom percent reaches 500.
for (int i = 0; i < 9; ++i) {
zoom::PageZoom::Zoom(first_tab, content::PAGE_ZOOM_IN);
}
// TODO(a.sarkar.arun@gmail.com): Figure out why Zoom-In menu item is not
// disabled after Max-zoom is reached. Force disable Zoom-In menu item
// from the context menu since it breaks try jobs on bots.
if (chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS))
chrome::UpdateCommandEnabled(browser(), IDC_ZOOM_PLUS, false);
ZoomController* zoom_controller = ZoomController::FromWebContents(first_tab);
EXPECT_FLOAT_EQ(500.0f, zoom_controller->GetZoomPercent());
EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
}
TEST_F(BrowserCommandsTest, OnMaxZoomOut) {
TabStripModel* tab_strip_model = browser()->tab_strip_model();
GURL url("http://www.google.com");
AddTab(browser(), url);
WebContents* first_tab = tab_strip_model->GetWebContentsAt(0);
// Continue to zoom out until zoom percent reaches 25.
for (int i = 0; i < 7; ++i) {
zoom::PageZoom::Zoom(first_tab, content::PAGE_ZOOM_OUT);
}
ZoomController* zoom_controller = ZoomController::FromWebContents(first_tab);
EXPECT_FLOAT_EQ(25.0f, zoom_controller->GetZoomPercent());
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
}
TEST_F(BrowserCommandsTest, OnZoomReset) {
TabStripModel* tab_strip_model = browser()->tab_strip_model();
GURL url("http://www.google.com");
AddTab(browser(), url);
WebContents* first_tab = tab_strip_model->GetWebContentsAt(0);
// Change the zoom percentage to 100.
zoom::PageZoom::Zoom(first_tab, content::PAGE_ZOOM_RESET);
ZoomController* zoom_controller = ZoomController::FromWebContents(first_tab);
EXPECT_FLOAT_EQ(100.0f, zoom_controller->GetZoomPercent());
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
// Changing the page scale factor will re-enable IDC_ZOOM_NORMAL
zoom_controller->SetPageScaleFactorIsOneForTesting(false);
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
}
TEST_F(BrowserCommandsTest, OnZoomLevelChanged) {
TabStripModel* tab_strip_model = browser()->tab_strip_model();
GURL url("http://www.google.com");
AddTab(browser(), url);
WebContents* first_tab = tab_strip_model->GetWebContentsAt(0);
// Changing zoom percentage from default should enable all the zoom
// NSMenuItems.
zoom::PageZoom::Zoom(first_tab, content::PAGE_ZOOM_IN);
ZoomController* zoom_controller = ZoomController::FromWebContents(first_tab);
EXPECT_FLOAT_EQ(110.0f, zoom_controller->GetZoomPercent());
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
}
TEST_F(BrowserCommandsTest, OnZoomChangedForActiveTab) {
TabStripModel* tab_strip_model = browser()->tab_strip_model();
GURL url("http://www.google.com");
GURL url1("http://code.google.com");
// Add First tab.
AddTab(browser(), url);
AddTab(browser(), url1);
WebContents* first_tab = tab_strip_model->GetWebContentsAt(0);
ZoomController* zoom_controller = ZoomController::FromWebContents(first_tab);
EXPECT_FLOAT_EQ(100.0f, zoom_controller->GetZoomPercent());
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
// Add Second tab.
WebContents* second_tab = tab_strip_model->GetWebContentsAt(1);
tab_strip_model->ActivateTabAt(1, {TabStripModel::GestureType::kOther});
EXPECT_TRUE(tab_strip_model->IsTabSelected(1));
zoom::PageZoom::Zoom(second_tab, content::PAGE_ZOOM_OUT);
zoom_controller = ZoomController::FromWebContents(second_tab);
EXPECT_FLOAT_EQ(90.0f, zoom_controller->GetZoomPercent());
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
}
TEST_F(BrowserCommandsTest, OnDefaultZoomLevelChanged) {
TabStripModel* tab_strip_model = browser()->tab_strip_model();
GURL url("http://code.google.com");
AddTab(browser(), url);
WebContents* tab = tab_strip_model->GetWebContentsAt(0);
ZoomController* zoom_controller = ZoomController::FromWebContents(tab);
// Set the default zoom level to 125.
profile()->GetZoomLevelPrefs()->SetDefaultZoomLevelPref(
blink::PageZoomFactorToZoomLevel(1.25));
EXPECT_FLOAT_EQ(125.0f, zoom_controller->GetZoomPercent());
// Actual Size from context menu should be disabled now.
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
// Change the zoom level.
zoom::PageZoom::Zoom(tab, content::PAGE_ZOOM_IN);
EXPECT_FLOAT_EQ(150.0f, zoom_controller->GetZoomPercent());
// Tab no longer at default zoom hence actual size should be enabled.
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
}
TEST_F(BrowserCommandsTest, ToggleCaretBrowsing) {
// Set initial known state for browser process TestingProfile.
PrefService* pref_service = profile()->GetPrefs();
pref_service->SetBoolean(prefs::kCaretBrowsingEnabled, false);
pref_service->SetBoolean(prefs::kShowCaretBrowsingDialog, false);
#if defined(OS_MAC)
// On Mac, caret browsing should be disabled unless focus is in web content.
// Make sure it's disabled initially and doesn't toggle if executed.
EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_CARET_BROWSING_TOGGLE));
chrome::ExecuteCommand(browser(), IDC_CARET_BROWSING_TOGGLE);
EXPECT_FALSE(pref_service->GetBoolean(prefs::kCaretBrowsingEnabled));
#endif
// Create multiple tabs to test if caret browsing mode gets broadcast to all
// tabs when toggled. (For the purposes of testing, this simulates
// putting focus in web contents as a side effect.)
GURL about_blank(url::kAboutBlankURL);
int tab_count = 3;
for (int i = 0; i < tab_count; ++i) {
AddTab(browser(), about_blank);
}
// Toggle on caret browsing.
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_CARET_BROWSING_TOGGLE));
chrome::ExecuteCommand(browser(), IDC_CARET_BROWSING_TOGGLE);
EXPECT_TRUE(pref_service->GetBoolean(prefs::kCaretBrowsingEnabled));
// Add another tab after toggling caret browsing mode--it should also have
// caret browsing mode set.
AddTab(browser(), about_blank);
tab_count++;
// Check renderer preferences for each tab.
for (int i = 0; i < tab_count; ++i) {
WebContents* web_contents =
browser()->tab_strip_model()->GetWebContentsAt(i);
blink::RendererPreferences* renderer_preferences =
web_contents->GetMutableRendererPrefs();
EXPECT_TRUE(renderer_preferences->caret_browsing_enabled);
}
// Toggle off caret browsing.
chrome::ExecuteCommand(browser(), IDC_CARET_BROWSING_TOGGLE);
EXPECT_FALSE(pref_service->GetBoolean(prefs::kCaretBrowsingEnabled));
// Add another tab after toggling caret browsing mode--it should also have
// caret browsing mode unset.
AddTab(browser(), about_blank);
tab_count++;
// Check renderer preferences for each tab.
for (int i = 0; i < tab_count; ++i) {
WebContents* web_contents =
browser()->tab_strip_model()->GetWebContentsAt(i);
blink::RendererPreferences* renderer_preferences =
web_contents->GetMutableRendererPrefs();
EXPECT_FALSE(renderer_preferences->caret_browsing_enabled);
}
}
TEST_F(BrowserCommandsTest, TabSearchCommandStatus) {
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_TAB_SEARCH));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_TAB_SEARCH_CLOSE));
}
} // namespace
|
/*-----------------------------------------------------------------------------------------------
The MIT License (MIT)
Copyright (c) 2015-2021 OSRE ( Open Source Render Engine ) by Kim Kulling
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-----------------------------------------------------------------------------------------------*/
#include <src/Engine/RenderBackend/OGLRenderer/OGLEnum.h>
#include <osre/Debugging/osre_debugging.h>
namespace OSRE {
namespace RenderBackend {
GLenum OGLEnum::getGLBufferType( BufferType type ) {
switch( type ) {
case BufferType::VertexBuffer:
case BufferType::InstanceBuffer:
return GL_ARRAY_BUFFER;
case BufferType::IndexBuffer:
return GL_ELEMENT_ARRAY_BUFFER;
case BufferType::UniformBuffer:
return GL_UNIFORM_BUFFER;
case BufferType::EmptyBuffer:
default:
osre_assert2( false, "Unknown enum for BufferType." );
break;
}
return GL_ARRAY_BUFFER;
}
GLenum OGLEnum::getGLBufferAccessType( BufferAccessType type ) {
switch( type ) {
case BufferAccessType::ReadOnly:
return GL_STATIC_DRAW;
case BufferAccessType::WriteOnly:
return GL_DYNAMIC_DRAW;
case BufferAccessType::ReadWrite:
return GL_DYNAMIC_DRAW;
default:
osre_assert2( false, "Unknown enum for buffer BufferAccessType." );
break;
}
return GL_STATIC_DRAW;
}
GLenum OGLEnum::getGLPrimitiveType( PrimitiveType primType ) {
switch( primType ) {
case PrimitiveType::PointList:
return GL_POINTS;
case PrimitiveType::LineList:
return GL_LINES;
case PrimitiveType::LineStrip:
return GL_LINE_STRIP;
case PrimitiveType::TriangleList:
return GL_TRIANGLES;
case PrimitiveType::TriangelStrip:
return GL_TRIANGLE_STRIP;
case PrimitiveType::TriangleFan:
return GL_TRIANGLE_FAN;
default:
osre_assert2( false, "Unknown enum for PrimitiveType." );
break;
}
return GL_TRIANGLES;
}
GLenum OGLEnum::getGLIndexType( IndexType indexType ) {
switch( indexType ) {
case IndexType::UnsignedByte:
return GL_UNSIGNED_BYTE;
case IndexType::UnsignedShort:
return GL_UNSIGNED_SHORT;
case IndexType::UnsignedInt:
return GL_UNSIGNED_INT;
default:
osre_assert2( false, "Unknown enum for IndexType." );
break;
}
return GL_UNSIGNED_SHORT;
}
GLenum OGLEnum::getGLTextureTarget( TextureTargetType type ) {
switch( type ) {
case TextureTargetType::Texture1D:
return GL_TEXTURE_1D;
case TextureTargetType::Texture2D:
return GL_TEXTURE_2D;
case TextureTargetType::Texture3D:
return GL_TEXTURE_3D;
default:
osre_assert2( false, "Unknown enum for TextureTargetType." );
break;
}
return GL_TEXTURE_2D;
}
GLenum OGLEnum::getGLTextureEnum( TextureParameterName name ) {
switch( name ) {
case TextureParameterName::TextureParamMinFilter:
return GL_TEXTURE_MIN_FILTER;
case TextureParameterName::TextureParamMagFilter:
return GL_TEXTURE_MAG_FILTER;
case TextureParameterName::TextureParamWrapS:
return GL_TEXTURE_WRAP_S;
case TextureParameterName::TextureParamWrapT:
return GL_TEXTURE_WRAP_T;
default:
osre_assert2( false, "Unknown enum for TextureParameterName." );
break;
}
return GL_TEXTURE_MIN_FILTER;
}
GLenum OGLEnum::getGLTextureFormat(PixelFormatType texFormat) {
switch (texFormat ) {
case PixelFormatType::R8G8B8:
return GL_RGB;
case PixelFormatType::R8G8B8A8:
return GL_RGBA;
case PixelFormatType::InvaliTextureType:
default:
osre_assert2( false, "Unknown enum for TextureParameterName." );
break;
}
return GL_RGB;
}
GLenum OGLEnum::getGLTextureStage( TextureStageType texType ) {
switch ( texType ) {
case TextureStageType::TextureStage0:
return GL_TEXTURE0;
case TextureStageType::TextureStage1:
return GL_TEXTURE1;
case TextureStageType::TextureStage2:
return GL_TEXTURE2;
case TextureStageType::TextureStage3:
return GL_TEXTURE3;
default:
osre_assert2( false, "Unknown enum for TextureStageType." );
break;
}
return GL_TEXTURE0;
}
GLenum OGLEnum::getOGLTypeForFormat( VertexFormat format ) {
switch ( format ) {
case VertexFormat::Float:
case VertexFormat::Float2:
case VertexFormat::Float3:
case VertexFormat::Float4:
return GL_FLOAT;
case VertexFormat::Byte4:
return GL_BYTE;
case VertexFormat::UByte4:
return GL_UNSIGNED_BYTE;
case VertexFormat::Short2:
case VertexFormat::Short4:
return GL_SHORT;
case VertexFormat::NumVertexFormats:
case VertexFormat::InvalidVertexFormat:
default:
osre_assert2( false, "Unknown enum for VertexFormat." );
break;
}
return GL_INVALID_ENUM;
}
ui32 OGLEnum::getOGLSizeForFormat( VertexFormat format ) {
switch ( format ) {
case VertexFormat::Float:
return 1;
case VertexFormat::Float2:
case VertexFormat::Short2:
return 2;
case VertexFormat::Float3:
return 3;
case VertexFormat::Byte4:
case VertexFormat::UByte4:
case VertexFormat::Float4:
case VertexFormat::Short4:
return 4;
case VertexFormat::NumVertexFormats:
case VertexFormat::InvalidVertexFormat:
return 0;
default:
osre_assert2( false, "Unknown enum for VertexFormat." );
break;
}
return 0;
}
GLenum OGLEnum::getOGLCullState( CullState::CullMode cullMode ) {
switch ( cullMode ) {
case CullState::CullMode::CW:
return GL_CW;
case CullState::CullMode::CCW:
return GL_CCW;
default:
osre_assert2( false, "Unknown enum for CullState::CullMode." );
break;
}
return GL_CW;
}
GLenum OGLEnum::getOGLCullFace( CullState::CullFace cullFace ) {
switch ( cullFace ) {
case CullState::CullFace::Front:
return GL_FRONT;
case CullState::CullFace::Back:
return GL_BACK;
case CullState::CullFace::FrontAndBack:
return GL_FRONT_AND_BACK;
default:
osre_assert2( false, "Unknown enum for CullState::CullFace." );
break;
}
return GL_BACK;
}
GLenum OGLEnum::getOGLPolygonMode( PolygonState::PolygonMode polyMode ) {
switch( polyMode ) {
case PolygonState::PolygonMode::Point:
return GL_POINT;
case PolygonState::PolygonMode::Line:
return GL_LINE;
case PolygonState::PolygonMode::Fill:
return GL_FILL;
default:
osre_assert2(false, "Unknown enum for PolygonState::PolygonMode.");
break;
}
return GL_FILL;
}
GLuint OGLEnum::getOGLShaderType( ShaderType type ) {
switch ( type ) {
case ShaderType::SH_VertexShaderType:
return GL_VERTEX_SHADER;
case ShaderType::SH_FragmentShaderType:
return GL_FRAGMENT_SHADER;
case ShaderType::SH_GeometryShaderType:
return GL_GEOMETRY_SHADER;
case ShaderType::SH_TesselationShaderType:
return GL_TESS_EVALUATION_SHADER;
default:
osre_assert2( false, "Unknown enum for ShaderType." );
break;
}
return 0;
}
} // Namespace RenderBackend
} // Namespace OSRE
|
// RUN: %clang_cc1 -std=c++11 %s -verify
// expected-no-diagnostics
using size_t = decltype(sizeof(0));
template<typename T> struct check;
template<size_t N> struct check<const char[N]> {};
constexpr bool startswith(const char *p, const char *q) {
return !*q || (*p == *q && startswith(p + 1, q + 1));
}
constexpr bool contains(const char *p, const char *q) {
return *p && (startswith(p, q) || contains(p + 1, q));
}
void foo() {
check<decltype(__func__)>();
static_assert(contains(__func__, "foo"), "");
}
|
// Copyright (c) 2011-2013 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "sendcoinsentry.h"
#include "ui_sendcoinsentry.h"
#include "guiutil.h"
#include "bitcoinunits.h"
#include "addressbookpage.h"
#include "walletmodel.h"
#include "optionsmodel.h"
#include "addresstablemodel.h"
#include <QApplication>
#include <QClipboard>
SendCoinsEntry::SendCoinsEntry(QWidget *parent) :
QFrame(parent),
ui(new Ui::SendCoinsEntry),
model(0)
{
ui->setupUi(this);
#ifdef Q_OS_MAC
ui->payToLayout->setSpacing(4);
#endif
#if QT_VERSION >= 0x040700
/* Do not move this to the XML file, Qt before 4.7 will choke on it */
ui->addAsLabel->setPlaceholderText(tr("Enter a label for this address to add it to your address book"));
ui->payTo->setPlaceholderText(tr("Enter a EyeGlass address or EyeGlass stealth address"));
#endif
setFocusPolicy(Qt::TabFocus);
setFocusProxy(ui->payTo);
GUIUtil::setupAddressWidget(ui->payTo, this);
}
SendCoinsEntry::~SendCoinsEntry()
{
delete ui;
}
void SendCoinsEntry::on_pasteButton_clicked()
{
// Paste text from clipboard into recipient field
ui->payTo->setText(QApplication::clipboard()->text());
}
void SendCoinsEntry::on_addressBookButton_clicked()
{
if(!model)
return;
AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::SendingTab, this);
dlg.setModel(model->getAddressTableModel());
if(dlg.exec())
{
ui->payTo->setText(dlg.getReturnValue());
ui->payAmount->setFocus();
}
}
void SendCoinsEntry::on_payTo_textChanged(const QString &address)
{
if(!model)
return;
// Fill in label from address book, if address has an associated label
QString associatedLabel = model->getAddressTableModel()->labelForAddress(address);
if(!associatedLabel.isEmpty())
ui->addAsLabel->setText(associatedLabel);
}
void SendCoinsEntry::setModel(WalletModel *model)
{
this->model = model;
if(model && model->getOptionsModel())
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
connect(ui->payAmount, SIGNAL(textChanged()), this, SIGNAL(payAmountChanged()));
clear();
}
void SendCoinsEntry::setRemoveEnabled(bool enabled)
{
ui->deleteButton->setEnabled(enabled);
}
void SendCoinsEntry::clear()
{
ui->payTo->clear();
ui->addAsLabel->clear();
ui->payAmount->clear();
ui->payTo->setFocus();
// update the display unit, to not use the default ("BTC")
updateDisplayUnit();
}
void SendCoinsEntry::on_deleteButton_clicked()
{
emit removeEntry(this);
}
bool SendCoinsEntry::validate()
{
// Check input validity
bool retval = true;
if(!ui->payAmount->validate())
{
retval = false;
}
else
{
if(ui->payAmount->value() <= 0)
{
// Cannot send 0 coins or less
ui->payAmount->setValid(false);
retval = false;
}
}
if(!ui->payTo->hasAcceptableInput() ||
(model && !model->validateAddress(ui->payTo->text(), true)))
{
ui->payTo->setValid(false);
retval = false;
}
return retval;
}
SendCoinsRecipient SendCoinsEntry::getValue()
{
SendCoinsRecipient rv;
rv.address = ui->payTo->text();
rv.label = ui->addAsLabel->text();
rv.amount = ui->payAmount->value();
return rv;
}
QWidget *SendCoinsEntry::setupTabChain(QWidget *prev)
{
QWidget::setTabOrder(prev, ui->payTo);
QWidget::setTabOrder(ui->payTo, ui->addressBookButton);
QWidget::setTabOrder(ui->addressBookButton, ui->pasteButton);
QWidget::setTabOrder(ui->pasteButton, ui->deleteButton);
QWidget::setTabOrder(ui->deleteButton, ui->addAsLabel);
return ui->payAmount->setupTabChain(ui->addAsLabel);
}
void SendCoinsEntry::setValue(const SendCoinsRecipient &value)
{
ui->payTo->setText(value.address);
ui->addAsLabel->setText(value.label);
ui->payAmount->setValue(value.amount);
}
void SendCoinsEntry::setAddress(const QString &address)
{
ui->payTo->setText(address);
ui->payAmount->setFocus();
}
bool SendCoinsEntry::isClear()
{
return ui->payTo->text().isEmpty();
}
void SendCoinsEntry::setFocus()
{
ui->payTo->setFocus();
}
void SendCoinsEntry::updateDisplayUnit()
{
if(model && model->getOptionsModel())
{
// Update payAmount with the current unit
ui->payAmount->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
}
}
|
/*=============================================================================
Copyright (c) 2001-2003 Joel de Guzman
http://spirit.sourceforge.net/
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef BOOST_SPIRIT_EXCEPTIONS_HPP
#define BOOST_SPIRIT_EXCEPTIONS_HPP
#include <boost/config.hpp>
#include <boost/throw_exception.hpp>
#include <boost/spirit/home/classic/namespace.hpp>
#include <boost/spirit/home/classic/core/parser.hpp>
#include <boost/spirit/home/classic/core/composite/composite.hpp>
#include <exception>
#include <boost/spirit/home/classic/error_handling/exceptions_fwd.hpp>
namespace boost { namespace spirit {
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
///////////////////////////////////////////////////////////////////////////
//
// parser_error_base class
//
// This is the base class of parser_error (see below). This may be
// used to catch any type of parser error.
//
// This exception shouldn't propagate outside the parser. However to
// avoid quirks of many platforms/implementations which fall outside
// the C++ standard, we derive parser_error_base from std::exception
// to allow a single catch handler to catch all exceptions.
//
///////////////////////////////////////////////////////////////////////////
class BOOST_SYMBOL_VISIBLE parser_error_base : public std::exception
{
protected:
parser_error_base() {}
virtual ~parser_error_base() BOOST_NOEXCEPT_OR_NOTHROW {}
public:
parser_error_base(parser_error_base const& rhs)
: std::exception(rhs) {}
parser_error_base& operator=(parser_error_base const&)
{
return *this;
}
};
///////////////////////////////////////////////////////////////////////////
//
// parser_error class
//
// Generic parser exception class. This is the base class for all
// parser exceptions. The exception holds the iterator position
// where the error was encountered in its member variable "where".
// The parser_error also holds information regarding the error
// (error descriptor) in its member variable "descriptor".
//
// The throw_ function creates and throws a parser_error given
// an iterator and an error descriptor.
//
///////////////////////////////////////////////////////////////////////////
template <typename ErrorDescrT, typename IteratorT>
struct parser_error : public parser_error_base
{
typedef ErrorDescrT error_descr_t;
typedef IteratorT iterator_t;
parser_error(IteratorT where_, ErrorDescrT descriptor_)
: where(where_), descriptor(descriptor_) {}
parser_error(parser_error const& rhs)
: parser_error_base(rhs)
, where(rhs.where), descriptor(rhs.descriptor) {}
parser_error&
operator=(parser_error const& rhs)
{
where = rhs.where;
descriptor = rhs.descriptor;
return *this;
}
virtual
~parser_error() BOOST_NOEXCEPT_OR_NOTHROW {}
virtual const char*
what() const BOOST_NOEXCEPT_OR_NOTHROW
{
return "BOOST_SPIRIT_CLASSIC_NS::parser_error";
}
IteratorT where;
ErrorDescrT descriptor;
};
//////////////////////////////////
template <typename ErrorDescrT, typename IteratorT>
inline void
throw_(IteratorT where, ErrorDescrT descriptor)
{
boost::throw_exception(
parser_error<ErrorDescrT, IteratorT>(where, descriptor));
}
///////////////////////////////////////////////////////////////////////////
//
// assertive_parser class
//
// An assertive_parser class is a parser that throws an exception
// in response to a parsing failure. The assertive_parser throws a
// parser_error exception rather than returning an unsuccessful
// match to signal that the parser failed to match the input.
//
///////////////////////////////////////////////////////////////////////////
template <typename ErrorDescrT, typename ParserT>
struct assertive_parser
: public unary<ParserT, parser<assertive_parser<ErrorDescrT, ParserT> > >
{
typedef assertive_parser<ErrorDescrT, ParserT> self_t;
typedef unary<ParserT, parser<self_t> > base_t;
typedef unary_parser_category parser_category_t;
assertive_parser(ParserT const& parser, ErrorDescrT descriptor_)
: base_t(parser), descriptor(descriptor_) {}
template <typename ScannerT>
struct result
{
typedef typename parser_result<ParserT, ScannerT>::type type;
};
template <typename ScannerT>
typename parser_result<self_t, ScannerT>::type
parse(ScannerT const& scan) const
{
typedef typename parser_result<ParserT, ScannerT>::type result_t;
result_t hit = this->subject().parse(scan);
if (!hit)
{
throw_(scan.first, descriptor);
}
return hit;
}
ErrorDescrT descriptor;
};
///////////////////////////////////////////////////////////////////////////
//
// assertion class
//
// assertive_parsers are never instantiated directly. The assertion
// class is used to indirectly create an assertive_parser object.
// Before declaring the grammar, we declare some assertion objects.
// Examples:
//
// enum Errors
// {
// program_expected, begin_expected, end_expected
// };
//
// assertion<Errors> expect_program(program_expected);
// assertion<Errors> expect_begin(begin_expected);
// assertion<Errors> expect_end(end_expected);
//
// Now, we can use these assertions as wrappers around parsers:
//
// expect_end(str_p("end"))
//
// Take note that although the example uses enums to hold the
// information regarding the error (error desccriptor), we are free
// to use other types such as integers and strings. Enums are
// convenient for error handlers to easily catch since C++ treats
// enums as unique types.
//
///////////////////////////////////////////////////////////////////////////
template <typename ErrorDescrT>
struct assertion
{
assertion(ErrorDescrT descriptor_)
: descriptor(descriptor_) {}
template <typename ParserT>
assertive_parser<ErrorDescrT, ParserT>
operator()(ParserT const& parser) const
{
return assertive_parser<ErrorDescrT, ParserT>(parser, descriptor);
}
ErrorDescrT descriptor;
};
///////////////////////////////////////////////////////////////////////////
//
// error_status<T>
//
// Where T is an attribute type compatible with the match attribute
// of the fallback_parser's subject (defaults to nil_t). The class
// error_status reports the result of an error handler (see
// fallback_parser). result can be one of:
//
// fail: quit and fail (return a no_match)
// retry: attempt error recovery, possibly moving the scanner
// accept: force success returning a matching length, moving
// the scanner appropriately and returning an attribute
// value
// rethrow: rethrows the error.
//
///////////////////////////////////////////////////////////////////////////
template <typename T>
struct error_status
{
enum result_t { fail, retry, accept, rethrow };
error_status(
result_t result_ = fail,
std::ptrdiff_t length_ = -1,
T const& value_ = T())
: result(result_), length(length_), value(value_) {}
result_t result;
std::ptrdiff_t length;
T value;
};
///////////////////////////////////////////////////////////////////////////
//
// fallback_parser class
//
// Handles exceptions of type parser_error<ErrorDescrT, IteratorT>
// thrown somewhere inside its embedded ParserT object. The class
// sets up a try block before delegating parsing to its subject.
// When an exception is caught, the catch block then calls the
// HandlerT object. HandlerT may be a function or a functor (with
// an operator() member function) compatible with the interface:
//
// error_status<T>
// handler(ScannerT const& scan, ErrorT error);
//
// Where scan points to the scanner state prior to parsing and error
// is the error that arose (see parser_error). The handler must
// return an error_status<T> object (see above).
//
///////////////////////////////////////////////////////////////////////////
namespace impl
{
template <typename RT, typename ParserT, typename ScannerT>
RT fallback_parser_parse(ParserT const& p, ScannerT const& scan);
}
template <typename ErrorDescrT, typename ParserT, typename HandlerT>
struct fallback_parser
: public unary<ParserT,
parser<fallback_parser<ErrorDescrT, ParserT, HandlerT> > >
{
typedef fallback_parser<ErrorDescrT, ParserT, HandlerT>
self_t;
typedef ErrorDescrT
error_descr_t;
typedef unary<ParserT, parser<self_t> >
base_t;
typedef unary_parser_category
parser_category_t;
fallback_parser(ParserT const& parser, HandlerT const& handler_)
: base_t(parser), handler(handler_) {}
template <typename ScannerT>
struct result
{
typedef typename parser_result<ParserT, ScannerT>::type type;
};
template <typename ScannerT>
typename parser_result<self_t, ScannerT>::type
parse(ScannerT const& scan) const
{
typedef typename parser_result<self_t, ScannerT>::type result_t;
return impl::fallback_parser_parse<result_t>(*this, scan);
}
HandlerT handler;
};
///////////////////////////////////////////////////////////////////////////
//
// guard class
//
// fallback_parser objects are not instantiated directly. The guard
// class is used to indirectly create a fallback_parser object.
// guards are typically predeclared just like assertions (see the
// assertion class above; the example extends the previous example
// introduced in the assertion class above):
//
// guard<Errors> my_guard;
//
// Errors, in this example is the error descriptor type we want to
// detect; This is essentially the ErrorDescrT template parameter
// of the fallback_parser class.
//
// my_guard may now be used in a grammar declaration as:
//
// my_guard(p)[h]
//
// where p is a parser, h is a function or functor compatible with
// fallback_parser's HandlerT (see above).
//
///////////////////////////////////////////////////////////////////////////
template <typename ErrorDescrT, typename ParserT>
struct guard_gen : public unary<ParserT, nil_t>
{
typedef guard<ErrorDescrT> parser_generator_t;
typedef unary_parser_category parser_category_t;
guard_gen(ParserT const& p)
: unary<ParserT, nil_t>(p) {}
template <typename HandlerT>
fallback_parser<ErrorDescrT, ParserT, HandlerT>
operator[](HandlerT const& handler) const
{
return fallback_parser<ErrorDescrT, ParserT, HandlerT>
(this->subject(), handler);
}
};
template <typename ErrorDescrT>
struct guard
{
template <typename ParserT>
struct result
{
typedef guard_gen<ErrorDescrT, ParserT> type;
};
template <typename ParserT>
static guard_gen<ErrorDescrT, ParserT>
generate(ParserT const& parser)
{
return guard_gen<ErrorDescrT, ParserT>(parser);
}
template <typename ParserT>
guard_gen<ErrorDescrT, ParserT>
operator()(ParserT const& parser) const
{
return guard_gen<ErrorDescrT, ParserT>(parser);
}
};
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
}} // namespace BOOST_SPIRIT_CLASSIC_NS
#include <boost/spirit/home/classic/error_handling/impl/exceptions.ipp>
#endif
|
#define WLED_DEFINE_GLOBAL_VARS //only in one source file, wled.cpp!
#include "wled.h"
#include "wled_ethernet.h"
#include <Arduino.h>
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_DISABLE_BROWNOUT_DET)
#include "soc/soc.h"
#include "soc/rtc_cntl_reg.h"
#endif
/*
* Main WLED class implementation. Mostly initialization and connection logic
*/
WLED::WLED()
{
}
// turns all LEDs off and restarts ESP
void WLED::reset()
{
briT = 0;
#ifdef WLED_ENABLE_WEBSOCKETS
ws.closeAll(1012);
#endif
long dly = millis();
while (millis() - dly < 450) {
yield(); // enough time to send response to client
}
setAllLeds();
DEBUG_PRINTLN(F("MODULE RESET"));
ESP.restart();
}
bool oappendi(int i)
{
char s[11];
sprintf(s, "%d", i);
return oappend(s);
}
bool oappend(const char* txt)
{
uint16_t len = strlen(txt);
if (olen + len >= SETTINGS_STACK_BUF_SIZE)
return false; // buffer full
strcpy(obuf + olen, txt);
olen += len;
return true;
}
void prepareHostname(char* hostname)
{
const char *pC = serverDescription;
uint8_t pos = 5;
while (*pC && pos < 24) { // while !null and not over length
if (isalnum(*pC)) { // if the current char is alpha-numeric append it to the hostname
hostname[pos] = *pC;
pos++;
} else if (*pC == ' ' || *pC == '_' || *pC == '-' || *pC == '+' || *pC == '!' || *pC == '?' || *pC == '*') {
hostname[pos] = '-';
pos++;
}
// else do nothing - no leading hyphens and do not include hyphens for all other characters.
pC++;
}
// if the hostname is left blank, use the mac address/default mdns name
if (pos < 6) {
sprintf(hostname + 5, "%*s", 6, escapedMac.c_str() + 6);
} else { //last character must not be hyphen
while (pos > 0 && hostname[pos -1] == '-') {
hostname[pos -1] = 0;
pos--;
}
}
}
//handle Ethernet connection event
void WiFiEvent(WiFiEvent_t event)
{
#ifdef WLED_USE_ETHERNET
char hostname[25] = "wled-";
#endif
switch (event) {
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
case SYSTEM_EVENT_ETH_START:
DEBUG_PRINT(F("ETH Started"));
break;
case SYSTEM_EVENT_ETH_CONNECTED:
DEBUG_PRINT(F("ETH Connected"));
if (!apActive) {
WiFi.disconnect(true);
}
if (staticIP != (uint32_t)0x00000000 && staticGateway != (uint32_t)0x00000000) {
ETH.config(staticIP, staticGateway, staticSubnet, IPAddress(8, 8, 8, 8));
} else {
ETH.config(INADDR_NONE, INADDR_NONE, INADDR_NONE);
}
// convert the "serverDescription" into a valid DNS hostname (alphanumeric)
prepareHostname(hostname);
ETH.setHostname(hostname);
showWelcomePage = false;
break;
case SYSTEM_EVENT_ETH_DISCONNECTED:
DEBUG_PRINT(F("ETH Disconnected"));
// This doesn't really affect ethernet per se,
// as it's only configured once. Rather, it
// may be necessary to reconnect the WiFi when
// ethernet disconnects, as a way to provide
// alternative access to the device.
forceReconnect = true;
break;
#endif
default:
break;
}
}
void WLED::loop()
{
#ifdef WLED_DEBUG
static unsigned long maxUsermodMillis = 0;
#endif
handleTime();
handleIR(); // 2nd call to function needed for ESP32 to return valid results -- should be good for ESP8266, too
handleConnection();
handleSerial();
handleNotifications();
handleTransitions();
#ifdef WLED_ENABLE_DMX
handleDMX();
#endif
userLoop();
#ifdef WLED_DEBUG
unsigned long usermodMillis = millis();
#endif
usermods.loop();
#ifdef WLED_DEBUG
usermodMillis = millis() - usermodMillis;
if (usermodMillis > maxUsermodMillis) maxUsermodMillis = usermodMillis;
#endif
yield();
handleIO();
handleIR();
handleAlexa();
yield();
if (doReboot)
reset();
if (doCloseFile) {
closeFile();
yield();
}
if (!realtimeMode || realtimeOverride) // block stuff if WARLS/Adalight is enabled
{
if (apActive)
dnsServer.processNextRequest();
#ifndef WLED_DISABLE_OTA
if (WLED_CONNECTED && aOtaEnabled)
ArduinoOTA.handle();
#endif
handleNightlight();
handlePlaylist();
yield();
handleHue();
#ifndef WLED_DISABLE_BLYNK
handleBlynk();
#endif
yield();
if (!offMode || strip.isOffRefreshRequred)
strip.service();
#ifdef ESP8266
else if (!noWifiSleep)
delay(1); //required to make sure ESP enters modem sleep (see #1184)
#endif
}
yield();
#ifdef ESP8266
MDNS.update();
#endif
//millis() rolls over every 50 days
if (lastMqttReconnectAttempt > millis()) {
rolloverMillis++;
lastMqttReconnectAttempt = 0;
strip.restartRuntime();
}
if (millis() - lastMqttReconnectAttempt > 30000) {
lastMqttReconnectAttempt = millis();
initMqtt();
yield();
// refresh WLED nodes list
refreshNodeList();
if (nodeBroadcastEnabled) {
sendSysInfoUDP();
for (uint8_t i = 0; i < 10; i++) {
// check that ips are valid (these checks may not be valid as unsure of when ip should not be 255)
if (specialSearchNodes[i] != INADDR_NONE) { // check that ip is not 255s
sendSysInfoUDP(specialSearchNodes[i]);
}
}
}
yield();
}
//LED settings have been saved, re-init busses
//This code block causes severe FPS drop on ESP32 with the original "if (busConfigs[0] != nullptr)" conditional. Investigate!
if (doInitBusses) {
doInitBusses = false;
DEBUG_PRINTLN(F("Re-init busses."));
bool aligned = strip.checkSegmentAlignment(); //see if old segments match old bus(ses)
busses.removeAll();
uint32_t mem = 0;
for (uint8_t i = 0; i < WLED_MAX_BUSSES; i++) {
if (busConfigs[i] == nullptr) break;
mem += BusManager::memUsage(*busConfigs[i]);
if (mem <= MAX_LED_MEMORY) {
busses.add(*busConfigs[i]);
}
delete busConfigs[i]; busConfigs[i] = nullptr;
}
strip.finalizeInit();
loadLedmap = 0;
if (aligned) strip.makeAutoSegments();
else strip.fixInvalidSegments();
yield();
serializeConfig();
}
if (loadLedmap >= 0) {
strip.deserializeMap(loadLedmap);
loadLedmap = -1;
}
yield();
handleWs();
handleStatusLED();
// DEBUG serial logging (every 30s)
#ifdef WLED_DEBUG
if (millis() - debugTime > 29999) {
DEBUG_PRINTLN(F("---DEBUG INFO---"));
DEBUG_PRINT(F("Runtime: ")); DEBUG_PRINTLN(millis());
DEBUG_PRINT(F("Unix time: ")); toki.printTime(toki.getTime());
DEBUG_PRINT(F("Free heap: ")); DEBUG_PRINTLN(ESP.getFreeHeap());
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_PSRAM)
if (psramFound()) {
DEBUG_PRINT(F("Total PSRAM: ")); DEBUG_PRINT(ESP.getPsramSize()/1024); DEBUG_PRINTLN("kB");
DEBUG_PRINT(F("Free PSRAM: ")); DEBUG_PRINT(ESP.getFreePsram()/1024); DEBUG_PRINTLN("kB");
} else
DEBUG_PRINTLN(F("No PSRAM"));
#endif
DEBUG_PRINT(F("Wifi state: ")); DEBUG_PRINTLN(WiFi.status());
if (WiFi.status() != lastWifiState) {
wifiStateChangedTime = millis();
}
lastWifiState = WiFi.status();
DEBUG_PRINT(F("State time: ")); DEBUG_PRINTLN(wifiStateChangedTime);
DEBUG_PRINT(F("NTP last sync: ")); DEBUG_PRINTLN(ntpLastSyncTime);
DEBUG_PRINT(F("Client IP: ")); DEBUG_PRINTLN(Network.localIP());
DEBUG_PRINT(F("Loops/sec: ")); DEBUG_PRINTLN(loops / 30);
DEBUG_PRINT(F("Max UM time[ms]: ")); DEBUG_PRINTLN(maxUsermodMillis);
loops = 0;
maxUsermodMillis = 0;
debugTime = millis();
}
loops++;
#endif // WLED_DEBUG
toki.resetTick();
}
void WLED::setup() // multiple definitions
{
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_DISABLE_BROWNOUT_DET)
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detection
#endif
Serial.begin(115200); // something here
Serial.setTimeout(50);
DEBUG_PRINTLN();
DEBUG_PRINT(F("---WLED "));
DEBUG_PRINT(versionString);
DEBUG_PRINT(" ");
DEBUG_PRINT(VERSION);
DEBUG_PRINTLN(F(" INIT---"));
#ifdef ARDUINO_ARCH_ESP32
DEBUG_PRINT(F("esp32 "));
DEBUG_PRINTLN(ESP.getSdkVersion());
#else
DEBUG_PRINT(F("esp8266 "));
DEBUG_PRINTLN(ESP.getCoreVersion());
#endif
DEBUG_PRINT(F("heap "));
DEBUG_PRINTLN(ESP.getFreeHeap());
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_PSRAM)
if (psramFound()) {
// GPIO16/GPIO17 reserved for SPI RAM
managed_pin_type pins[2] = { {16, true}, {17, true} };
pinManager.allocateMultiplePins(pins, 2, PinOwner::SPI_RAM);
}
#endif
//DEBUG_PRINT(F("LEDs inited. heap usage ~"));
//DEBUG_PRINTLN(heapPreAlloc - ESP.getFreeHeap());
#ifdef WLED_DEBUG
pinManager.allocatePin(1, true, PinOwner::DebugOut); // GPIO1 reserved for debug output
#endif
#ifdef WLED_ENABLE_DMX //reserve GPIO2 as hardcoded DMX pin
pinManager.allocatePin(2, true, PinOwner::DMX);
#endif
DEBUG_PRINTLN(F("Registering usermods ..."));
registerUsermods();
for (uint8_t i=1; i<WLED_MAX_BUTTONS; i++) btnPin[i] = -1;
bool fsinit = false;
DEBUGFS_PRINTLN(F("Mount FS"));
#ifdef ARDUINO_ARCH_ESP32
fsinit = WLED_FS.begin(true);
#else
fsinit = WLED_FS.begin();
#endif
if (!fsinit) {
DEBUGFS_PRINTLN(F("FS failed!"));
errorFlag = ERR_FS_BEGIN;
} else deEEP();
updateFSInfo();
DEBUG_PRINTLN(F("Reading config"));
deserializeConfigFromFS();
#if STATUSLED
if (!pinManager.isPinAllocated(STATUSLED)) {
// NOTE: Special case: The status LED should *NOT* be allocated.
// See comments in handleStatusLed().
pinMode(STATUSLED, OUTPUT);
}
#endif
DEBUG_PRINTLN(F("Initializing strip"));
beginStrip();
DEBUG_PRINTLN(F("Usermods setup"));
userSetup();
usermods.setup();
if (strcmp(clientSSID, DEFAULT_CLIENT_SSID) == 0)
showWelcomePage = true;
WiFi.persistent(false);
#ifdef WLED_USE_ETHERNET
WiFi.onEvent(WiFiEvent);
#endif
#ifdef WLED_ENABLE_ADALIGHT
//Serial RX (Adalight, Improv, Serial JSON) only possible if GPIO3 unused
//Serial TX (Debug, Improv, Serial JSON) only possible if GPIO1 unused
if (!pinManager.isPinAllocated(3) && !pinManager.isPinAllocated(1)) {
Serial.println(F("Ada"));
}
#endif
// generate module IDs
escapedMac = WiFi.macAddress();
escapedMac.replace(":", "");
escapedMac.toLowerCase();
if (strcmp(cmDNS, "x") == 0) // fill in unique mdns default
{
strcpy_P(cmDNS, PSTR("wled-"));
sprintf(cmDNS + 5, "%*s", 6, escapedMac.c_str() + 6);
}
if (mqttDeviceTopic[0] == 0) {
strcpy_P(mqttDeviceTopic, PSTR("wled/"));
sprintf(mqttDeviceTopic + 5, "%*s", 6, escapedMac.c_str() + 6);
}
if (mqttClientID[0] == 0) {
strcpy_P(mqttClientID, PSTR("WLED-"));
sprintf(mqttClientID + 5, "%*s", 6, escapedMac.c_str() + 6);
}
if (Serial.available() > 0 && Serial.peek() == 'I') handleImprovPacket();
strip.service();
#ifndef WLED_DISABLE_OTA
if (aOtaEnabled) {
ArduinoOTA.onStart([]() {
#ifdef ESP8266
wifi_set_sleep_type(NONE_SLEEP_T);
#endif
DEBUG_PRINTLN(F("Start ArduinoOTA"));
});
if (strlen(cmDNS) > 0)
ArduinoOTA.setHostname(cmDNS);
}
#endif
#ifdef WLED_ENABLE_DMX
initDMX();
#endif
if (Serial.available() > 0 && Serial.peek() == 'I') handleImprovPacket();
// HTTP server page init
initServer();
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_DISABLE_BROWNOUT_DET)
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 1); //enable brownout detector
#endif
}
void WLED::beginStrip()
{
// Initialize NeoPixel Strip and button
strip.finalizeInit(); // busses created during deserializeConfig()
strip.deserializeMap();
strip.makeAutoSegments();
strip.setBrightness(0);
strip.setShowCallback(handleOverlayDraw);
if (turnOnAtBoot) {
if (briS > 0) bri = briS;
else if (bri == 0) bri = 128;
} else {
briLast = briS; bri = 0;
}
if (bootPreset > 0) {
applyPreset(bootPreset, CALL_MODE_INIT);
}
colorUpdated(CALL_MODE_INIT);
// init relay pin
if (rlyPin>=0)
digitalWrite(rlyPin, (rlyMde ? bri : !bri));
}
void WLED::initAP(bool resetAP)
{
if (apBehavior == AP_BEHAVIOR_BUTTON_ONLY && !resetAP)
return;
if (!apSSID[0] || resetAP)
strcpy_P(apSSID, PSTR("WLED-AP"));
if (resetAP)
strcpy_P(apPass, PSTR(DEFAULT_AP_PASS));
DEBUG_PRINT(F("Opening access point "));
DEBUG_PRINTLN(apSSID);
WiFi.softAPConfig(IPAddress(4, 3, 2, 1), IPAddress(4, 3, 2, 1), IPAddress(255, 255, 255, 0));
WiFi.softAP(apSSID, apPass, apChannel, apHide);
if (!apActive) // start captive portal if AP active
{
DEBUG_PRINTLN(F("Init AP interfaces"));
server.begin();
if (udpPort > 0 && udpPort != ntpLocalPort) {
udpConnected = notifierUdp.begin(udpPort);
}
if (udpRgbPort > 0 && udpRgbPort != ntpLocalPort && udpRgbPort != udpPort) {
udpRgbConnected = rgbUdp.begin(udpRgbPort);
}
if (udpPort2 > 0 && udpPort2 != ntpLocalPort && udpPort2 != udpPort && udpPort2 != udpRgbPort) {
udp2Connected = notifier2Udp.begin(udpPort2);
}
e131.begin(false, e131Port, e131Universe, E131_MAX_UNIVERSE_COUNT);
ddp.begin(false, DDP_DEFAULT_PORT);
dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
dnsServer.start(53, "*", WiFi.softAPIP());
}
apActive = true;
}
bool WLED::initEthernet()
{
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
static bool successfullyConfiguredEthernet = false;
if (successfullyConfiguredEthernet) {
// DEBUG_PRINTLN(F("initE: ETH already successfully configured, ignoring"));
return false;
}
if (ethernetType == WLED_ETH_NONE) {
return false;
}
if (ethernetType >= WLED_NUM_ETH_TYPES) {
DEBUG_PRINT(F("initE: Ignoring attempt for invalid ethernetType ")); DEBUG_PRINTLN(ethernetType);
return false;
}
DEBUG_PRINT(F("initE: Attempting ETH config: ")); DEBUG_PRINTLN(ethernetType);
// Ethernet initialization should only succeed once -- else reboot required
ethernet_settings es = ethernetBoards[ethernetType];
managed_pin_type pinsToAllocate[10] = {
// first six pins are non-configurable
esp32_nonconfigurable_ethernet_pins[0],
esp32_nonconfigurable_ethernet_pins[1],
esp32_nonconfigurable_ethernet_pins[2],
esp32_nonconfigurable_ethernet_pins[3],
esp32_nonconfigurable_ethernet_pins[4],
esp32_nonconfigurable_ethernet_pins[5],
{ (int8_t)es.eth_mdc, true }, // [6] = MDC is output and mandatory
{ (int8_t)es.eth_mdio, true }, // [7] = MDIO is bidirectional and mandatory
{ (int8_t)es.eth_power, true }, // [8] = optional pin, not all boards use
{ ((int8_t)0xFE), false }, // [9] = replaced with eth_clk_mode, mandatory
};
// update the clock pin....
if (es.eth_clk_mode == ETH_CLOCK_GPIO0_IN) {
pinsToAllocate[9].pin = 0;
pinsToAllocate[9].isOutput = false;
} else if (es.eth_clk_mode == ETH_CLOCK_GPIO0_OUT) {
pinsToAllocate[9].pin = 0;
pinsToAllocate[9].isOutput = true;
} else if (es.eth_clk_mode == ETH_CLOCK_GPIO16_OUT) {
pinsToAllocate[9].pin = 16;
pinsToAllocate[9].isOutput = true;
} else if (es.eth_clk_mode == ETH_CLOCK_GPIO17_OUT) {
pinsToAllocate[9].pin = 17;
pinsToAllocate[9].isOutput = true;
} else {
DEBUG_PRINT(F("initE: Failing due to invalid eth_clk_mode ("));
DEBUG_PRINT(es.eth_clk_mode);
DEBUG_PRINTLN(F(")"));
return false;
}
if (!pinManager.allocateMultiplePins(pinsToAllocate, 10, PinOwner::Ethernet)) {
DEBUG_PRINTLN(F("initE: Failed to allocate ethernet pins"));
return false;
}
if (!ETH.begin(
(uint8_t) es.eth_address,
(int) es.eth_power,
(int) es.eth_mdc,
(int) es.eth_mdio,
(eth_phy_type_t) es.eth_type,
(eth_clock_mode_t) es.eth_clk_mode
)) {
DEBUG_PRINTLN(F("initC: ETH.begin() failed"));
// de-allocate the allocated pins
for (managed_pin_type mpt : pinsToAllocate) {
pinManager.deallocatePin(mpt.pin, PinOwner::Ethernet);
}
return false;
}
successfullyConfiguredEthernet = true;
DEBUG_PRINTLN(F("initC: *** Ethernet successfully configured! ***"));
return true;
#else
return false; // Ethernet not enabled for build
#endif
}
void WLED::initConnection()
{
#ifdef WLED_ENABLE_WEBSOCKETS
ws.onEvent(wsEvent);
#endif
WiFi.disconnect(true); // close old connections
#ifdef ESP8266
WiFi.setPhyMode(WIFI_PHY_MODE_11N);
#endif
if (staticIP[0] != 0 && staticGateway[0] != 0) {
WiFi.config(staticIP, staticGateway, staticSubnet, IPAddress(1, 1, 1, 1));
} else {
WiFi.config(0U, 0U, 0U);
}
lastReconnectAttempt = millis();
if (!WLED_WIFI_CONFIGURED) {
DEBUG_PRINT(F("No connection configured. "));
if (!apActive)
initAP(); // instantly go to ap mode
return;
} else if (!apActive) {
if (apBehavior == AP_BEHAVIOR_ALWAYS) {
initAP();
} else {
DEBUG_PRINTLN(F("Access point disabled."));
WiFi.softAPdisconnect(true);
WiFi.mode(WIFI_STA);
}
}
showWelcomePage = false;
DEBUG_PRINT(F("Connecting to "));
DEBUG_PRINT(clientSSID);
DEBUG_PRINTLN("...");
// convert the "serverDescription" into a valid DNS hostname (alphanumeric)
char hostname[25] = "wled-";
prepareHostname(hostname);
#ifdef ESP8266
WiFi.hostname(hostname);
#endif
WiFi.begin(clientSSID, clientPass);
#ifdef ARDUINO_ARCH_ESP32
WiFi.setSleep(!noWifiSleep);
WiFi.setHostname(hostname);
#else
wifi_set_sleep_type((noWifiSleep) ? NONE_SLEEP_T : MODEM_SLEEP_T);
#endif
}
void WLED::initInterfaces()
{
DEBUG_PRINTLN(F("Init STA interfaces"));
#ifndef WLED_DISABLE_HUESYNC
IPAddress ipAddress = Network.localIP();
if (hueIP[0] == 0) {
hueIP[0] = ipAddress[0];
hueIP[1] = ipAddress[1];
hueIP[2] = ipAddress[2];
}
#endif
// init Alexa hue emulation
if (alexaEnabled)
alexaInit();
#ifndef WLED_DISABLE_OTA
if (aOtaEnabled)
ArduinoOTA.begin();
#endif
strip.service();
// Set up mDNS responder:
if (strlen(cmDNS) > 0) {
// "end" must be called before "begin" is called a 2nd time
// see https://github.com/esp8266/Arduino/issues/7213
MDNS.end();
MDNS.begin(cmDNS);
DEBUG_PRINTLN(F("mDNS started"));
MDNS.addService("http", "tcp", 80);
MDNS.addService("wled", "tcp", 80);
MDNS.addServiceTxt("wled", "tcp", "mac", escapedMac.c_str());
}
server.begin();
if (udpPort > 0 && udpPort != ntpLocalPort) {
udpConnected = notifierUdp.begin(udpPort);
if (udpConnected && udpRgbPort != udpPort)
udpRgbConnected = rgbUdp.begin(udpRgbPort);
if (udpConnected && udpPort2 != udpPort && udpPort2 != udpRgbPort)
udp2Connected = notifier2Udp.begin(udpPort2);
}
if (ntpEnabled)
ntpConnected = ntpUdp.begin(ntpLocalPort);
#ifndef WLED_DISABLE_BLYNK
initBlynk(blynkApiKey, blynkHost, blynkPort);
#endif
e131.begin(e131Multicast, e131Port, e131Universe, E131_MAX_UNIVERSE_COUNT);
ddp.begin(false, DDP_DEFAULT_PORT);
reconnectHue();
initMqtt();
interfacesInited = true;
wasConnected = true;
}
void WLED::handleConnection()
{
static byte stacO = 0;
static uint32_t lastHeap = UINT32_MAX;
static unsigned long heapTime = 0;
unsigned long now = millis();
if (now < 2000 && (!WLED_WIFI_CONFIGURED || apBehavior == AP_BEHAVIOR_ALWAYS))
return;
if (lastReconnectAttempt == 0)
initConnection();
// reconnect WiFi to clear stale allocations if heap gets too low
if (now - heapTime > 5000) {
uint32_t heap = ESP.getFreeHeap();
if (heap < MIN_HEAP_SIZE && lastHeap < MIN_HEAP_SIZE) {
DEBUG_PRINT(F("Heap too low! "));
DEBUG_PRINTLN(heap);
forceReconnect = true;
}
lastHeap = heap;
heapTime = now;
}
byte stac = 0;
if (apActive) {
#ifdef ESP8266
stac = wifi_softap_get_station_num();
#else
wifi_sta_list_t stationList;
esp_wifi_ap_get_sta_list(&stationList);
stac = stationList.num;
#endif
if (stac != stacO) {
stacO = stac;
DEBUG_PRINT(F("Connected AP clients: "));
DEBUG_PRINTLN(stac);
if (!WLED_CONNECTED && WLED_WIFI_CONFIGURED) { // trying to connect, but not connected
if (stac)
WiFi.disconnect(); // disable search so that AP can work
else
initConnection(); // restart search
}
}
}
if (forceReconnect) {
DEBUG_PRINTLN(F("Forcing reconnect."));
initConnection();
interfacesInited = false;
forceReconnect = false;
wasConnected = false;
return;
}
if (!Network.isConnected()) {
if (interfacesInited) {
DEBUG_PRINTLN(F("Disconnected!"));
interfacesInited = false;
initConnection();
}
//send improv failed 6 seconds after second init attempt (24 sec. after provisioning)
if (improvActive > 2 && now - lastReconnectAttempt > 6000) {
sendImprovStateResponse(0x03, true);
improvActive = 2;
}
if (now - lastReconnectAttempt > ((stac) ? 300000 : 18000) && WLED_WIFI_CONFIGURED) {
if (improvActive == 2) improvActive = 3;
initConnection();
}
if (!apActive && now - lastReconnectAttempt > 12000 && (!wasConnected || apBehavior == AP_BEHAVIOR_NO_CONN))
initAP();
} else if (!interfacesInited) { //newly connected
DEBUG_PRINTLN("");
DEBUG_PRINT(F("Connected! IP address: "));
DEBUG_PRINTLN(Network.localIP());
if (improvActive) {
if (improvError == 3) sendImprovStateResponse(0x00, true);
sendImprovStateResponse(0x04);
if (improvActive > 1) sendImprovRPCResponse(0x01);
}
initInterfaces();
userConnected();
usermods.connected();
// shut down AP
if (apBehavior != AP_BEHAVIOR_ALWAYS && apActive) {
dnsServer.stop();
WiFi.softAPdisconnect(true);
apActive = false;
DEBUG_PRINTLN(F("Access point disabled."));
}
}
}
// If status LED pin is allocated for other uses, does nothing
// else blink at 1Hz when WLED_CONNECTED is false (no WiFi, ?? no Ethernet ??)
// else blink at 2Hz when MQTT is enabled but not connected
// else turn the status LED off
void WLED::handleStatusLED()
{
#if STATUSLED
static unsigned long ledStatusLastMillis = 0;
static unsigned short ledStatusType = 0; // current status type - corresponds to number of blinks per second
static bool ledStatusState = 0; // the current LED state
if (pinManager.isPinAllocated(STATUSLED)) {
return; //lower priority if something else uses the same pin
}
ledStatusType = WLED_CONNECTED ? 0 : 2;
if (mqttEnabled && ledStatusType != 2) { // Wi-Fi takes precendence over MQTT
ledStatusType = WLED_MQTT_CONNECTED ? 0 : 4;
}
if (ledStatusType) {
if (millis() - ledStatusLastMillis >= (1000/ledStatusType)) {
ledStatusLastMillis = millis();
ledStatusState = ledStatusState ? 0 : 1;
digitalWrite(STATUSLED, ledStatusState);
}
} else {
#ifdef STATUSLEDINVERTED
digitalWrite(STATUSLED, HIGH);
#else
digitalWrite(STATUSLED, LOW);
#endif
}
#endif
}
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <exception>
#include <iomanip>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include "flashlight/app/imgclass/dataset/Imagenet.h"
#include "flashlight/app/objdet/models/Resnet50Backbone.h"
#include "flashlight/ext/common/DistributedUtils.h"
#include "flashlight/ext/image/af/Transforms.h"
#include "flashlight/ext/image/fl/dataset/DistributedDataset.h"
#include "flashlight/fl/dataset/datasets.h"
#include "flashlight/fl/meter/meters.h"
#include "flashlight/fl/optim/optim.h"
#include "flashlight/lib/common/System.h"
DEFINE_string(data_dir, "", "Directory of imagenet data");
DEFINE_double(train_lr, 0.1f, "Learning rate");
DEFINE_double(train_momentum, 0.9f, "Momentum");
DEFINE_double(train_wd, 1e-4f, "Weight decay");
DEFINE_uint64(train_epochs, 50, "Number of epochs to train");
DEFINE_bool(distributed_enable, true, "Enable distributed training");
DEFINE_int64(
distributed_max_devices_per_node,
8,
"the maximum number of devices per training node");
DEFINE_int64(
distributed_world_rank,
0,
"rank of the process (Used if distributed_rndv_filepath is not empty)");
DEFINE_int64(
distributed_world_size,
1,
"total number of the process (Used if distributed_rndv_filepath is not empty)");
DEFINE_string(
distributed_rndv_filepath,
"",
"Shared file path used for setting up rendezvous."
"If empty, uses MPI to initialize.");
DEFINE_uint64(data_batch_size, 256, "Total batch size across all gpus");
DEFINE_string(exp_checkpoint_path, "/tmp/model", "Checkpointing prefix path");
DEFINE_int64(exp_checkpoint_epoch, -1, "Checkpoint epoch to load from");
using namespace fl;
using fl::ext::image::compose;
using fl::ext::image::ImageTransform;
using namespace fl::app::imgclass;
#define FL_LOG_MASTER(lvl) LOG_IF(lvl, (fl::getWorldRank() == 0))
// Returns the average loss, top 5 error, and top 1 error
std::tuple<double, double, double> evalLoop(
std::shared_ptr<Module> model,
Dataset& dataset) {
AverageValueMeter lossMeter;
TopKMeter top5Acc(5);
TopKMeter top1Acc(1);
// Place the model in eval mode.
model->eval();
for (auto& example : dataset) {
auto inputs = noGrad(example[kImagenetInputIdx]);
auto output = model->forward({inputs})[0];
auto target = noGrad(example[kImagenetTargetIdx]);
// Compute and record the loss.
auto loss = categoricalCrossEntropy(output, target);
lossMeter.add(loss.array().scalar<float>());
top5Acc.add(output.array(), target.array());
top1Acc.add(output.array(), target.array());
}
model->train();
fl::ext::syncMeter(lossMeter);
fl::ext::syncMeter(top5Acc);
fl::ext::syncMeter(top1Acc);
double loss = lossMeter.value()[0];
return std::make_tuple(loss, top5Acc.value(), top1Acc.value());
};
int main(int argc, char** argv) {
fl::init();
google::InitGoogleLogging(argv[0]);
google::InstallFailureSignalHandler();
gflags::ParseCommandLineFlags(&argc, &argv, true);
const std::string labelPath = lib::pathsConcat(FLAGS_data_dir, "labels.txt");
const std::string trainList = lib::pathsConcat(FLAGS_data_dir, "train");
const std::string valList = lib::pathsConcat(FLAGS_data_dir, "val");
/////////////////////////
// Setup distributed training
////////////////////////
af::info();
if (FLAGS_distributed_enable) {
fl::ext::initDistributed(
FLAGS_distributed_world_rank,
FLAGS_distributed_world_size,
FLAGS_distributed_max_devices_per_node,
FLAGS_distributed_rndv_filepath);
}
const int worldRank = fl::getWorldRank();
const int worldSize = fl::getWorldSize();
const bool isMaster = (worldRank == 0);
af::setDevice(worldRank);
af::setSeed(worldSize);
auto reducer =
std::make_shared<fl::CoalescingReducer>(1.0 / worldSize, true, true);
//////////////////////////
// Create datasets
/////////////////////////
// These are the mean and std for each channel of Imagenet
const std::vector<float> mean = {0.485, 0.456, 0.406};
const std::vector<float> std = {0.229, 0.224, 0.225};
const int randomResizeMax = 480;
const int randomResizeMin = 256;
const int randomCropSize = 224;
const float horizontalFlipProb = 0.5f;
// TransformDataset will apply each transform in a vector to the respective
// af::array. Thus, we need to `compose` all of the transforms so are each
// applied only to the image
ImageTransform trainTransforms = compose(
{// randomly resize shortest side of image between 256 to 480 for
// scale invariance
fl::ext::image::randomResizeTransform(randomResizeMin, randomResizeMax),
fl::ext::image::randomCropTransform(randomCropSize, randomCropSize),
fl::ext::image::normalizeImage(mean, std),
// Randomly flip image with probability of 0.5
fl::ext::image::randomHorizontalFlipTransform(horizontalFlipProb)});
ImageTransform valTransforms =
compose({// Resize shortest side to 256, then take a center crop
fl::ext::image::resizeTransform(randomResizeMin),
fl::ext::image::centerCropTransform(randomCropSize),
fl::ext::image::normalizeImage(mean, std)});
const int64_t batchSizePerGpu = FLAGS_data_batch_size;
const int64_t prefetchThreads = 10;
const int64_t prefetchSize = FLAGS_data_batch_size;
auto labelMap = getImagenetLabels(labelPath);
auto trainDataset = fl::ext::image::DistributedDataset(
imagenetDataset(trainList, labelMap, {trainTransforms}),
worldRank,
worldSize,
batchSizePerGpu,
1, // train_n_repeatedaug
prefetchThreads,
prefetchSize,
fl::BatchDatasetPolicy::INCLUDE_LAST);
auto valDataset = fl::ext::image::DistributedDataset(
imagenetDataset(valList, labelMap, {valTransforms}),
worldRank,
worldSize,
batchSizePerGpu,
1, // train_n_repeatedaug
prefetchThreads,
prefetchSize,
fl::BatchDatasetPolicy::INCLUDE_LAST);
//////////////////////////
// Load model and optimizer
/////////////////////////
auto model = std::make_shared<fl::app::objdet::Resnet50Backbone>();
// synchronize parameters of the model so that the parameters in each process
// is the same
fl::allReduceParameters(model);
// Add a hook to synchronize gradients of model parameters as they are
// computed
fl::distributeModuleGrads(model, reducer);
SGDOptimizer opt(
model->params(), FLAGS_train_lr, FLAGS_train_momentum, FLAGS_train_wd);
auto lrScheduler = [&opt](int epoch) {
// Adjust learning rate every 30 epoch after 30
if (epoch == 60 || epoch == 90 || epoch == 120) {
const float newLr = opt.getLr() * 0.1;
LOG(INFO) << "Setting learning rate to: " << newLr;
opt.setLr(newLr);
}
};
// Small utility functions to load and save models
auto saveModel = [&model, &isMaster](int epoch) {
if (isMaster) {
std::string modelPath = FLAGS_exp_checkpoint_path + std::to_string(epoch);
LOG(INFO) << "Saving model to file: " << modelPath;
fl::save(modelPath, model);
}
};
auto loadModel = [&model](int epoch) {
std::string modelPath = FLAGS_exp_checkpoint_path + std::to_string(epoch);
LOG(INFO) << "Loading model from file: " << modelPath;
fl::load(modelPath, model);
};
if (FLAGS_exp_checkpoint_epoch >= 0) {
loadModel(FLAGS_exp_checkpoint_epoch);
}
// The main training loop
TimeMeter timeMeter;
TopKMeter top5Acc(5);
TopKMeter top1Acc(1);
AverageValueMeter trainLossMeter;
for (int epoch = (FLAGS_exp_checkpoint_epoch + 1); epoch < FLAGS_train_epochs;
epoch++) {
trainDataset.resample();
lrScheduler(epoch);
// Get an iterator over the data
timeMeter.resume();
int idx = 0;
for (auto& example : trainDataset) {
opt.zeroGrad();
// Make a Variable from the input array.
auto inputs = noGrad(example[kImagenetInputIdx]);
// Get the activations from the model.
auto output = model->forward({inputs})[0];
// Make a Variable from the target array.
auto target = noGrad(example[kImagenetTargetIdx]);
// Compute and record the loss.
auto loss = categoricalCrossEntropy(output, target);
trainLossMeter.add(loss.array());
top5Acc.add(output.array(), target.array());
top1Acc.add(output.array(), target.array());
// Backprop, update the weights and then zero the gradients.
loss.backward();
if (FLAGS_distributed_enable) {
reducer->finalize();
}
opt.step();
// Compute and record the prediction error.
double trainLoss = trainLossMeter.value()[0];
if (++idx % 50 == 0) {
fl::ext::syncMeter(trainLossMeter);
fl::ext::syncMeter(timeMeter);
fl::ext::syncMeter(top5Acc);
fl::ext::syncMeter(top1Acc);
double time = timeMeter.value();
double samplePerSecond = (idx * FLAGS_data_batch_size) / time;
FL_LOG_MASTER(INFO)
<< "Epoch " << epoch << std::setprecision(5) << " Batch: " << idx
<< " Samples per second " << samplePerSecond
<< ": Avg Train Loss: " << trainLoss
<< ": Train Top5 Accuracy( %): " << top5Acc.value()
<< ": Train Top1 Accuracy( %): " << top1Acc.value();
top5Acc.reset();
top1Acc.reset();
trainLossMeter.reset();
}
}
timeMeter.reset();
timeMeter.stop();
double valLoss, valTop1Error, valTop5Err;
std::tie(valLoss, valTop5Err, valTop1Error) = evalLoop(model, valDataset);
FL_LOG_MASTER(INFO) << "Epoch " << epoch << std::setprecision(5)
<< " Validation Loss: " << valLoss
<< " Validation Top5 Error (%): " << valTop5Err
<< " Validation Top1 Error (%): " << valTop1Error;
saveModel(epoch);
}
FL_LOG_MASTER(INFO) << "Training complete";
}
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* DiamondTrap.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mamaurai <mamaurai@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/30 16:30:08 by mamaurai #+# #+# */
/* Updated: 2022/04/30 17:27:17 by mamaurai ### ########.fr */
/* */
/* ************************************************************************** */
#include "DiamondTrap.hpp"
DiamondTrap::DiamondTrap (void) :
ClapTrap("UNKNOWN_clap_name", 100, 50, 30),
ScavTrap (),
FragTrap (),
name("UNKNOWN")
{
if (CPP_DEBUG) {std::cout << "Diamond default constructor called" << std::endl;}
return;
}
DiamondTrap::DiamondTrap (const DiamondTrap& ref)
{
*this = ref;
if (CPP_DEBUG) {std::cout << "Diamond copy constructor called" << std::endl;}
return;
}
DiamondTrap::DiamondTrap (const std::string& name) :
ClapTrap (name + "_clap_name", 100, 50, 30),
ScavTrap (),
FragTrap (),
name(name)
{
if (CPP_DEBUG) {std::cout << "Diamond string constructor called" << std::endl;}
return;
}
DiamondTrap::~DiamondTrap (void)
{
if (CPP_DEBUG) {std::cout << "Diamond default destructor called" << std::endl;}
return;
}
DiamondTrap& DiamondTrap::operator=(const DiamondTrap& ref)
{
if (this == &ref) {return *this;}
this->ClapTrap::_name = ref.ClapTrap::_name;
this->ClapTrap::_hit_point = ref.ClapTrap::_hit_point;
this->ClapTrap::_attack_damage = ref.ClapTrap::_attack_damage;
this->ClapTrap::_energy_point = ref.ClapTrap::_energy_point;
this->name = ref.name;
return (*this);
}
void
DiamondTrap::whoAmI() const
{
std::cout << "Name :" << this->name << " ClapTrap name : "
<< this->ClapTrap::_name << std::endl;
}
void
DiamondTrap::attack (const std::string& target)
{
this->ScavTrap::attack (target);
}
|
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2018 The PIVX developers
// Copyright (c) 2017-2018 The HUZU developers
// Copyright (c) 2018-2019 The ZIJA developers
// Copyright (c) 2019 The 2PAY developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "amount.h"
#include "base58.h"
#include "chainparams.h"
#include "core_io.h"
#include "init.h"
#include "main.h"
#include "miner.h"
#include "net.h"
#include "pow.h"
#include "rpcserver.h"
#include "util.h"
#ifdef ENABLE_WALLET
#include "db.h"
#include "wallet.h"
#endif
#include <stdint.h>
#include <boost/assign/list_of.hpp>
#include <univalue.h>
using namespace std;
/**
* Return average network hashes per second based on the last 'lookup' blocks,
* or from the last difficulty change if 'lookup' is nonpositive.
* If 'height' is nonnegative, compute the estimate at the time when a given block was found.
*/
UniValue GetNetworkHashPS(int lookup, int height)
{
CBlockIndex *pb = chainActive.Tip();
if (height >= 0 && height < chainActive.Height())
pb = chainActive[height];
if (pb == NULL || !pb->nHeight)
return 0;
// If lookup is -1, then use blocks since last difficulty change.
if (lookup <= 0)
lookup = pb->nHeight % 2016 + 1;
// If lookup is larger than chain, then set it to chain length.
if (lookup > pb->nHeight)
lookup = pb->nHeight;
CBlockIndex* pb0 = pb;
int64_t minTime = pb0->GetBlockTime();
int64_t maxTime = minTime;
for (int i = 0; i < lookup; i++) {
pb0 = pb0->pprev;
int64_t time = pb0->GetBlockTime();
minTime = std::min(time, minTime);
maxTime = std::max(time, maxTime);
}
// In case there's a situation where minTime == maxTime, we don't want a divide by zero exception.
if (minTime == maxTime)
return 0;
uint256 workDiff = pb->nChainWork - pb0->nChainWork;
int64_t timeDiff = maxTime - minTime;
return (int64_t)(workDiff.getdouble() / timeDiff);
}
UniValue getnetworkhashps(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() > 2)
throw runtime_error(
"getnetworkhashps ( blocks height )\n"
"\nReturns the estimated network hashes per second based on the last n blocks.\n"
"Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n"
"Pass in [height] to estimate the network speed at the time when a certain block was found.\n"
"\nArguments:\n"
"1. blocks (numeric, optional, default=120) The number of blocks, or -1 for blocks since last difficulty change.\n"
"2. height (numeric, optional, default=-1) To estimate at the time of the given height.\n"
"\nResult:\n"
"x (numeric) Hashes per second estimated\n"
"\nExamples:\n" +
HelpExampleCli("getnetworkhashps", "") + HelpExampleRpc("getnetworkhashps", ""));
LOCK(cs_main);
return GetNetworkHashPS(params.size() > 0 ? params[0].get_int() : 120, params.size() > 1 ? params[1].get_int() : -1);
}
#ifdef ENABLE_WALLET
UniValue getgenerate(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getgenerate\n"
"\nReturn if the server is set to generate coins or not. The default is false.\n"
"It is set with the command line argument -gen (or cointopay.conf setting gen)\n"
"It can also be set with the setgenerate call.\n"
"\nResult\n"
"true|false (boolean) If the server is set to generate coins or not\n"
"\nExamples:\n" +
HelpExampleCli("getgenerate", "") + HelpExampleRpc("getgenerate", ""));
LOCK(cs_main);
return GetBoolArg("-gen", false);
}
UniValue setgenerate(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"setgenerate generate ( genproclimit )\n"
"\nSet 'generate' true or false to turn generation on or off.\n"
"Generation is limited to 'genproclimit' processors, -1 is unlimited.\n"
"See the getgenerate call for the current setting.\n"
"\nArguments:\n"
"1. generate (boolean, required) Set to true to turn on generation, false to turn off.\n"
"2. genproclimit (numeric, optional) Set the processor limit for when generation is on. Can be -1 for unlimited.\n"
" Note: in -regtest mode, genproclimit controls how many blocks are generated immediately.\n"
"\nResult\n"
"[ blockhashes ] (array, -regtest only) hashes of blocks generated\n"
"\nExamples:\n"
"\nSet the generation on with a limit of one processor\n" +
HelpExampleCli("setgenerate", "true 1") +
"\nCheck the setting\n" + HelpExampleCli("getgenerate", "") +
"\nTurn off generation\n" + HelpExampleCli("setgenerate", "false") +
"\nUsing json rpc\n" + HelpExampleRpc("setgenerate", "true, 1"));
if (pwalletMain == NULL)
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found (disabled)");
bool fGenerate = true;
if (params.size() > 0)
fGenerate = params[0].get_bool();
int nGenProcLimit = -1;
if (params.size() > 1) {
nGenProcLimit = params[1].get_int();
if (nGenProcLimit == 0)
fGenerate = false;
}
// -regtest mode: don't return until nGenProcLimit blocks are generated
if (fGenerate && Params().MineBlocksOnDemand()) {
int nHeightStart = 0;
int nHeightEnd = 0;
int nHeight = 0;
int nGenerate = (nGenProcLimit > 0 ? nGenProcLimit : 1);
CReserveKey reservekey(pwalletMain);
{ // Don't keep cs_main locked
LOCK(cs_main);
nHeightStart = chainActive.Height();
nHeight = nHeightStart;
nHeightEnd = nHeightStart + nGenerate;
}
unsigned int nExtraNonce = 0;
UniValue blockHashes(UniValue::VARR);
while (nHeight < nHeightEnd) {
unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey, pwalletMain, false));
if (!pblocktemplate.get())
throw JSONRPCError(RPC_INTERNAL_ERROR, "Wallet keypool empty");
CBlock* pblock = &pblocktemplate->block;
{
LOCK(cs_main);
IncrementExtraNonce(pblock, chainActive.Tip(), nExtraNonce);
}
while (!CheckProofOfWork(pblock->GetHash(), pblock->nBits)) {
// Yes, there is a chance every nonce could fail to satisfy the -regtest
// target -- 1 in 2^(2^32). That ain't gonna happen.
++pblock->nNonce;
}
CValidationState state;
if (!ProcessNewBlock(state, NULL, pblock))
throw JSONRPCError(RPC_INTERNAL_ERROR, "ProcessNewBlock, block not accepted");
++nHeight;
blockHashes.push_back(pblock->GetHash().GetHex());
}
return blockHashes;
} else // Not -regtest: start generate thread, return immediately
{
mapArgs["-gen"] = (fGenerate ? "1" : "0");
mapArgs["-genproclimit"] = itostr(nGenProcLimit);
GenerateBitcoins(fGenerate, pwalletMain, nGenProcLimit);
}
return NullUniValue;
}
UniValue gethashespersec(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"gethashespersec\n"
"\nReturns a recent hashes per second performance measurement while generating.\n"
"See the getgenerate and setgenerate calls to turn generation on and off.\n"
"\nResult:\n"
"n (numeric) The recent hashes per second when generation is on (will return 0 if generation is off)\n"
"\nExamples:\n" +
HelpExampleCli("gethashespersec", "") + HelpExampleRpc("gethashespersec", ""));
if (GetTimeMillis() - nHPSTimerStart > 8000)
return (int64_t)0;
return (int64_t)dHashesPerSec;
}
#endif
UniValue getmininginfo(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getmininginfo\n"
"\nReturns a json object containing mining-related information."
"\nResult:\n"
"{\n"
" \"blocks\": nnn, (numeric) The current block\n"
" \"currentblocksize\": nnn, (numeric) The last block size\n"
" \"currentblocktx\": nnn, (numeric) The last block transaction\n"
" \"difficulty\": xxx.xxxxx (numeric) The current difficulty\n"
" \"errors\": \"...\" (string) Current errors\n"
" \"generate\": true|false (boolean) If the generation is on or off (see getgenerate or setgenerate calls)\n"
" \"genproclimit\": n (numeric) The processor limit for generation. -1 if no generation. (see getgenerate or setgenerate calls)\n"
" \"hashespersec\": n (numeric) The hashes per second of the generation, or 0 if no generation.\n"
" \"pooledtx\": n (numeric) The size of the mem pool\n"
" \"testnet\": true|false (boolean) If using testnet or not\n"
" \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n"
"}\n"
"\nExamples:\n" +
HelpExampleCli("getmininginfo", "") + HelpExampleRpc("getmininginfo", ""));
LOCK(cs_main);
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("blocks", (int)chainActive.Height()));
obj.push_back(Pair("currentblocksize", (uint64_t)nLastBlockSize));
obj.push_back(Pair("currentblocktx", (uint64_t)nLastBlockTx));
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
obj.push_back(Pair("errors", GetWarnings("statusbar")));
obj.push_back(Pair("genproclimit", (int)GetArg("-genproclimit", -1)));
obj.push_back(Pair("networkhashps", getnetworkhashps(params, false)));
obj.push_back(Pair("pooledtx", (uint64_t)mempool.size()));
obj.push_back(Pair("testnet", Params().TestnetToBeDeprecatedFieldRPC()));
obj.push_back(Pair("chain", Params().NetworkIDString()));
#ifdef ENABLE_WALLET
obj.push_back(Pair("generate", getgenerate(params, false)));
obj.push_back(Pair("hashespersec", gethashespersec(params, false)));
#endif
return obj;
}
// NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts
UniValue prioritisetransaction(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 3)
throw runtime_error(
"prioritisetransaction <txid> <priority delta> <fee delta>\n"
"Accepts the transaction into mined blocks at a higher (or lower) priority\n"
"\nArguments:\n"
"1. \"txid\" (string, required) The transaction id.\n"
"2. priority delta (numeric, required) The priority to add or subtract.\n"
" The transaction selection algorithm considers the tx as it would have a higher priority.\n"
" (priority of a transaction is calculated: coinage * value_in_upiv / txsize) \n"
"3. fee delta (numeric, required) The fee value (in upiv) to add (or subtract, if negative).\n"
" The fee is not actually paid, only the algorithm for selecting transactions into a block\n"
" considers the transaction as it would have paid a higher (or lower) fee.\n"
"\nResult\n"
"true (boolean) Returns true\n"
"\nExamples:\n" +
HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000") + HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000"));
LOCK(cs_main);
uint256 hash = ParseHashStr(params[0].get_str(), "txid");
CAmount nAmount = params[2].get_int64();
mempool.PrioritiseTransaction(hash, params[0].get_str(), params[1].get_real(), nAmount);
return true;
}
// NOTE: Assumes a conclusive result; if result is inconclusive, it must be handled by caller
static UniValue BIP22ValidationResult(const CValidationState& state)
{
if (state.IsValid())
return NullUniValue;
std::string strRejectReason = state.GetRejectReason();
if (state.IsError())
throw JSONRPCError(RPC_VERIFY_ERROR, strRejectReason);
if (state.IsInvalid()) {
if (strRejectReason.empty())
return "rejected";
return strRejectReason;
}
// Should be impossible
return "valid?";
}
UniValue getblocktemplate(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() > 1)
throw runtime_error(
"getblocktemplate ( \"jsonrequestobject\" )\n"
"\nIf the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.\n"
"It returns data needed to construct a block to work on.\n"
"See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n"
"\nArguments:\n"
"1. \"jsonrequestobject\" (string, optional) A json object in the following spec\n"
" {\n"
" \"mode\":\"template\" (string, optional) This must be set to \"template\" or omitted\n"
" \"capabilities\":[ (array, optional) A list of strings\n"
" \"support\" (string) client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid'\n"
" ,...\n"
" ]\n"
" }\n"
"\n"
"\nResult:\n"
"{\n"
" \"version\" : n, (numeric) The block version\n"
" \"previousblockhash\" : \"xxxx\", (string) The hash of current highest block\n"
" \"transactions\" : [ (array) contents of non-coinbase transactions that should be included in the next block\n"
" {\n"
" \"data\" : \"xxxx\", (string) transaction data encoded in hexadecimal (byte-for-byte)\n"
" \"hash\" : \"xxxx\", (string) hash/id encoded in little-endian hexadecimal\n"
" \"depends\" : [ (array) array of numbers \n"
" n (numeric) transactions before this one (by 1-based index in 'transactions' list) that must be present in the final block if this one is\n"
" ,...\n"
" ],\n"
" \"fee\": n, (numeric) difference in value between transaction inputs and outputs (in upiv); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one\n"
" \"sigops\" : n, (numeric) total number of SigOps, as counted for purposes of block limits; if key is not present, sigop count is unknown and clients MUST NOT assume there aren't any\n"
" \"required\" : true|false (boolean) if provided and true, this transaction must be in the final block\n"
" }\n"
" ,...\n"
" ],\n"
" \"coinbaseaux\" : { (json object) data that should be included in the coinbase's scriptSig content\n"
" \"flags\" : \"flags\" (string) \n"
" },\n"
" \"coinbasevalue\" : n, (numeric) maximum allowable input to coinbase transaction, including the generation award and transaction fees (in upiv)\n"
" \"coinbasetxn\" : { ... }, (json object) information for coinbase transaction\n"
" \"target\" : \"xxxx\", (string) The hash target\n"
" \"mintime\" : xxx, (numeric) The minimum timestamp appropriate for next block time in seconds since epoch (Jan 1 1970 GMT)\n"
" \"mutable\" : [ (array of string) list of ways the block template may be changed \n"
" \"value\" (string) A way the block template may be changed, e.g. 'time', 'transactions', 'prevblock'\n"
" ,...\n"
" ],\n"
" \"noncerange\" : \"00000000ffffffff\", (string) A range of valid nonces\n"
" \"sigoplimit\" : n, (numeric) limit of sigops in blocks\n"
" \"sizelimit\" : n, (numeric) limit of block size\n"
" \"curtime\" : ttt, (numeric) current timestamp in seconds since epoch (Jan 1 1970 GMT)\n"
" \"bits\" : \"xxx\", (string) compressed target of next block\n"
" \"height\" : n (numeric) The height of the next block\n"
" \"payee\" : \"xxx\", (string) required payee for the next block\n"
" \"payee_amount\" : n, (numeric) required amount to pay\n"
" \"votes\" : [\n (array) show vote candidates\n"
" { ... } (json object) vote candidate\n"
" ,...\n"
" ],\n"
" \"masternode_payments\" : true|false, (boolean) true, if masternode payments are enabled\n"
" \"enforce_masternode_payments\" : true|false (boolean) true, if masternode payments are enforced\n"
"}\n"
"\nExamples:\n" +
HelpExampleCli("getblocktemplate", "") + HelpExampleRpc("getblocktemplate", ""));
LOCK(cs_main);
std::string strMode = "template";
UniValue lpval = NullUniValue;
if (params.size() > 0) {
const UniValue& oparam = params[0].get_obj();
const UniValue& modeval = find_value(oparam, "mode");
if (modeval.isStr())
strMode = modeval.get_str();
else if (modeval.isNull()) {
/* Do nothing */
} else
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
lpval = find_value(oparam, "longpollid");
if (strMode == "proposal") {
const UniValue& dataval = find_value(oparam, "data");
if (!dataval.isStr())
throw JSONRPCError(RPC_TYPE_ERROR, "Missing data String key for proposal");
CBlock block;
if (!DecodeHexBlk(block, dataval.get_str()))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
uint256 hash = block.GetHash();
BlockMap::iterator mi = mapBlockIndex.find(hash);
if (mi != mapBlockIndex.end()) {
CBlockIndex* pindex = mi->second;
if (pindex->IsValid(BLOCK_VALID_SCRIPTS))
return "duplicate";
if (pindex->nStatus & BLOCK_FAILED_MASK)
return "duplicate-invalid";
return "duplicate-inconclusive";
}
CBlockIndex* const pindexPrev = chainActive.Tip();
// TestBlockValidity only supports blocks built on the current Tip
if (block.hashPrevBlock != pindexPrev->GetBlockHash())
return "inconclusive-not-best-prevblk";
CValidationState state;
TestBlockValidity(state, block, pindexPrev, false, true);
return BIP22ValidationResult(state);
}
}
if (strMode != "template")
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
if (vNodes.empty())
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "2PAY is not connected!");
if (IsInitialBlockDownload())
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "2PAY is downloading blocks...");
static unsigned int nTransactionsUpdatedLast;
if (!lpval.isNull()) {
// Wait to respond until either the best block changes, OR a minute has passed and there are more transactions
uint256 hashWatchedChain;
boost::system_time checktxtime;
unsigned int nTransactionsUpdatedLastLP;
if (lpval.isStr()) {
// Format: <hashBestChain><nTransactionsUpdatedLast>
std::string lpstr = lpval.get_str();
hashWatchedChain.SetHex(lpstr.substr(0, 64));
nTransactionsUpdatedLastLP = atoi64(lpstr.substr(64));
} else {
// NOTE: Spec does not specify behaviour for non-string longpollid, but this makes testing easier
hashWatchedChain = chainActive.Tip()->GetBlockHash();
nTransactionsUpdatedLastLP = nTransactionsUpdatedLast;
}
// Release the wallet and main lock while waiting
LEAVE_CRITICAL_SECTION(cs_main);
{
checktxtime = boost::get_system_time() + boost::posix_time::minutes(1);
boost::unique_lock<boost::mutex> lock(csBestBlock);
while (chainActive.Tip()->GetBlockHash() == hashWatchedChain && IsRPCRunning()) {
if (!cvBlockChange.timed_wait(lock, checktxtime)) {
// Timeout: Check transactions for update
if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLastLP)
break;
checktxtime += boost::posix_time::seconds(10);
}
}
}
ENTER_CRITICAL_SECTION(cs_main);
if (!IsRPCRunning())
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Shutting down");
// TODO: Maybe recheck connections/IBD and (if something wrong) send an expires-immediately template to stop miners?
}
// Update block
static CBlockIndex* pindexPrev;
static int64_t nStart;
static CBlockTemplate* pblocktemplate;
if (pindexPrev != chainActive.Tip() ||
(mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 5)) {
// Clear pindexPrev so future calls make a new block, despite any failures from here on
pindexPrev = NULL;
// Store the chainActive.Tip() used before CreateNewBlock, to avoid races
nTransactionsUpdatedLast = mempool.GetTransactionsUpdated();
CBlockIndex* pindexPrevNew = chainActive.Tip();
nStart = GetTime();
// Create new block
if (pblocktemplate) {
delete pblocktemplate;
pblocktemplate = NULL;
}
CScript scriptDummy = CScript() << OP_TRUE;
pblocktemplate = CreateNewBlock(scriptDummy, pwalletMain, false);
if (!pblocktemplate)
throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory");
// Need to update only after we know CreateNewBlock succeeded
pindexPrev = pindexPrevNew;
}
CBlock* pblock = &pblocktemplate->block; // pointer for convenience
// Update nTime
UpdateTime(pblock, pindexPrev);
pblock->nNonce = 0;
UniValue aCaps(UniValue::VARR); aCaps.push_back("proposal");
UniValue transactions(UniValue::VARR);
map<uint256, int64_t> setTxIndex;
int i = 0;
BOOST_FOREACH (CTransaction& tx, pblock->vtx) {
uint256 txHash = tx.GetHash();
setTxIndex[txHash] = i++;
if (tx.IsCoinBase())
continue;
UniValue entry(UniValue::VOBJ);
entry.push_back(Pair("data", EncodeHexTx(tx)));
entry.push_back(Pair("hash", txHash.GetHex()));
UniValue deps(UniValue::VARR);
BOOST_FOREACH (const CTxIn& in, tx.vin) {
if (setTxIndex.count(in.prevout.hash))
deps.push_back(setTxIndex[in.prevout.hash]);
}
entry.push_back(Pair("depends", deps));
int index_in_template = i - 1;
entry.push_back(Pair("fee", pblocktemplate->vTxFees[index_in_template]));
entry.push_back(Pair("sigops", pblocktemplate->vTxSigOps[index_in_template]));
transactions.push_back(entry);
}
UniValue aux(UniValue::VOBJ);
aux.push_back(Pair("flags", HexStr(COINBASE_FLAGS.begin(), COINBASE_FLAGS.end())));
uint256 hashTarget = uint256().SetCompact(pblock->nBits);
static UniValue aMutable(UniValue::VARR);
if (aMutable.empty()) {
aMutable.push_back("time");
aMutable.push_back("transactions");
aMutable.push_back("prevblock");
}
UniValue aVotes(UniValue::VARR);
UniValue result(UniValue::VOBJ);
result.push_back(Pair("capabilities", aCaps));
result.push_back(Pair("version", pblock->nVersion));
result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex()));
result.push_back(Pair("transactions", transactions));
result.push_back(Pair("coinbaseaux", aux));
result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].GetValueOut()));
result.push_back(Pair("longpollid", chainActive.Tip()->GetBlockHash().GetHex() + i64tostr(nTransactionsUpdatedLast)));
result.push_back(Pair("target", hashTarget.GetHex()));
result.push_back(Pair("mintime", (int64_t)pindexPrev->GetMedianTimePast() + 1));
result.push_back(Pair("mutable", aMutable));
result.push_back(Pair("noncerange", "00000000ffffffff"));
// result.push_back(Pair("sigoplimit", (int64_t)MAX_BLOCK_SIGOPS));
// result.push_back(Pair("sizelimit", (int64_t)MAX_BLOCK_SIZE));
result.push_back(Pair("curtime", pblock->GetBlockTime()));
result.push_back(Pair("bits", strprintf("%08x", pblock->nBits)));
result.push_back(Pair("height", (int64_t)(pindexPrev->nHeight + 1)));
result.push_back(Pair("votes", aVotes));
if (pblock->payee != CScript()) {
CTxDestination address1;
ExtractDestination(pblock->payee, address1);
CBitcoinAddress address2(address1);
result.push_back(Pair("payee", address2.ToString().c_str()));
result.push_back(Pair("payee_amount", (int64_t)pblock->vtx[0].vout[1].nValue));
} else {
result.push_back(Pair("payee", ""));
result.push_back(Pair("payee_amount", ""));
}
result.push_back(Pair("masternode_payments", pblock->nTime > Params().StartMasternodePayments()));
result.push_back(Pair("enforce_masternode_payments", true));
return result;
}
class submitblock_StateCatcher : public CValidationInterface
{
public:
uint256 hash;
bool found;
CValidationState state;
submitblock_StateCatcher(const uint256& hashIn) : hash(hashIn), found(false), state(){};
protected:
virtual void BlockChecked(const CBlock& block, const CValidationState& stateIn)
{
if (block.GetHash() != hash)
return;
found = true;
state = stateIn;
};
};
UniValue submitblock(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"submitblock \"hexdata\" ( \"jsonparametersobject\" )\n"
"\nAttempts to submit new block to network.\n"
"The 'jsonparametersobject' parameter is currently ignored.\n"
"See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n"
"\nArguments\n"
"1. \"hexdata\" (string, required) the hex-encoded block data to submit\n"
"2. \"jsonparametersobject\" (string, optional) object of optional parameters\n"
" {\n"
" \"workid\" : \"id\" (string, optional) if the server provided a workid, it MUST be included with submissions\n"
" }\n"
"\nResult:\n"
"\nExamples:\n" +
HelpExampleCli("submitblock", "\"mydata\"") + HelpExampleRpc("submitblock", "\"mydata\""));
CBlock block;
if (!DecodeHexBlk(block, params[0].get_str()))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
uint256 hash = block.GetHash();
bool fBlockPresent = false;
{
LOCK(cs_main);
BlockMap::iterator mi = mapBlockIndex.find(hash);
if (mi != mapBlockIndex.end()) {
CBlockIndex* pindex = mi->second;
if (pindex->IsValid(BLOCK_VALID_SCRIPTS))
return "duplicate";
if (pindex->nStatus & BLOCK_FAILED_MASK)
return "duplicate-invalid";
// Otherwise, we might only have the header - process the block before returning
fBlockPresent = true;
}
}
CValidationState state;
submitblock_StateCatcher sc(block.GetHash());
RegisterValidationInterface(&sc);
bool fAccepted = ProcessNewBlock(state, NULL, &block);
UnregisterValidationInterface(&sc);
if (fBlockPresent) {
if (fAccepted && !sc.found)
return "duplicate-inconclusive";
return "duplicate";
}
if (fAccepted) {
if (!sc.found)
return "inconclusive";
state = sc.state;
}
return BIP22ValidationResult(state);
}
UniValue estimatefee(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"estimatefee nblocks\n"
"\nEstimates the approximate fee per kilobyte\n"
"needed for a transaction to begin confirmation\n"
"within nblocks blocks.\n"
"\nArguments:\n"
"1. nblocks (numeric)\n"
"\nResult:\n"
"n : (numeric) estimated fee-per-kilobyte\n"
"\n"
"-1.0 is returned if not enough transactions and\n"
"blocks have been observed to make an estimate.\n"
"\nExample:\n" +
HelpExampleCli("estimatefee", "6"));
RPCTypeCheck(params, boost::assign::list_of(UniValue::VNUM));
int nBlocks = params[0].get_int();
if (nBlocks < 1)
nBlocks = 1;
CFeeRate feeRate = mempool.estimateFee(nBlocks);
if (feeRate == CFeeRate(0))
return -1.0;
return ValueFromAmount(feeRate.GetFeePerK());
}
UniValue estimatepriority(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"estimatepriority nblocks\n"
"\nEstimates the approximate priority\n"
"a zero-fee transaction needs to begin confirmation\n"
"within nblocks blocks.\n"
"\nArguments:\n"
"1. nblocks (numeric)\n"
"\nResult:\n"
"n : (numeric) estimated priority\n"
"\n"
"-1.0 is returned if not enough transactions and\n"
"blocks have been observed to make an estimate.\n"
"\nExample:\n" +
HelpExampleCli("estimatepriority", "6"));
RPCTypeCheck(params, boost::assign::list_of(UniValue::VNUM));
int nBlocks = params[0].get_int();
if (nBlocks < 1)
nBlocks = 1;
return mempool.estimatePriority(nBlocks);
}
|
// Copyright (c) 2019 The CounosH Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <logging.h>
#include <logging/timer.h>
#include <test/util/setup_common.h>
#include <chrono>
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(logging_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(logging_timer)
{
SetMockTime(1);
auto sec_timer = BCLog::Timer<std::chrono::seconds>("tests", "end_msg");
SetMockTime(2);
BOOST_CHECK_EQUAL(sec_timer.LogMsg("test secs"), "tests: test secs (1.00s)");
SetMockTime(1);
auto ms_timer = BCLog::Timer<std::chrono::milliseconds>("tests", "end_msg");
SetMockTime(2);
BOOST_CHECK_EQUAL(ms_timer.LogMsg("test ms"), "tests: test ms (1000.00ms)");
SetMockTime(1);
auto micro_timer = BCLog::Timer<std::chrono::microseconds>("tests", "end_msg");
SetMockTime(2);
BOOST_CHECK_EQUAL(micro_timer.LogMsg("test micros"), "tests: test micros (1000000.00μs)");
SetMockTime(0);
}
BOOST_AUTO_TEST_SUITE_END()
|
#include <iostream>
#include <string>
using namespace std;
/*
My first Calculator in C++
*/
// Defining some vars
int selectvar;
double num1;
double num2;
double outputresult;
// Defining functions
int add(double num1, double num2);
int sub(double num1, double num2);
// Writing operator functions
int add(double num1, double num2) {
int result;
//Doing da operation stuff
result = num1 + num2;
return result;
}
int sub(double num1, double num2) {
int result;
//Doing da operation stuff
result = num1 - num2;
return result;
}
// Defining Operation selector function
void select() {
// Printing some shitty instructions
cout << "Enter one of the following strings to select an operation \n1 for addition, \n2 for subtraction.";
cout << "\nEnter one of the Integers to select an Operator: ";
// Getting input
cin >> selectvar;
cout << "\nEnter First number: ";
cin >> num1;
cout << "\nEnter First number: ";
cin >> num2;
// Using switch statement to run function
switch(selectvar) {
case 1 :
outputresult = add(num1 ,num2);
break;
case 2 :
outputresult = sub(num1, num2);
break;
}
cout << "\nThe result is: " << outputresult;
}
int main() {
string continuevar;
//Starting selector
select();
//Asking user if program should be repeated
cout << "\nShould program be repeated? [y/n]: ";
cin >> continuevar;
if ( continuevar == "y" ) {
main();
}
else {
exit;
}
}
|
//
// Copyright (c) 2011-2012 Krzysztof Jusiak (krzysztof at jusiak dot net)
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef QFSM_BACK_DETAIL_EXECUTION_STATE_HPP
#define QFSM_BACK_DETAIL_EXECUTION_STATE_HPP
#include <boost/mpl/at.hpp>
#include <boost/mpl/find.hpp>
#include "QFsm/Back/Aux/State.hpp"
namespace QFsm
{
namespace Back
{
namespace Detail
{
namespace Execution
{
typedef int State;
} // namespace Execution
} // namespace Detail
namespace Aux
{
template<typename TFsm>
class State<Back::Detail::Execution::State, TFsm>
{
public:
static void init(Back::Detail::Execution::State& p_state, const boost::mpl::int_<0>&)
{
p_state = boost::mpl::find<typename TFsm::States, typename TFsm::InitialState>::type::pos::value;
}
template<int region> static void init(Back::Detail::Execution::State& p_state, const boost::mpl::int_<region>&)
{
typedef typename boost::mpl::at_c<typename TFsm::InitialState, region - 1>::type state;
p_state = boost::mpl::find<typename TFsm::States, state>::type::pos::value;
}
template<typename TState> static bool equals(const Back::Detail::Execution::State& p_state)
{
return static_cast<int>(boost::mpl::find<typename TFsm::States, TState>::type::pos::value) == p_state;
}
};
} // namespace Aux
} // namespace Back
} // namespace QFsm
#endif
|
// Copyright (c) 2012-2019 The TurboStake developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <kernel.h>
#include <chainparams.h>
#include <util.h>
#include <validation.h>
#include <streams.h>
#include <timedata.h>
#include <bignum.h>
#include <txdb.h>
#include <consensus/validation.h>
#include <random.h>
#include <boost/assign/list_of.hpp>
using namespace std;
// Protocol switch time of v0.3 kernel protocol
unsigned int nProtocolV03SwitchTime = 1435808381; // https://github.com/TurboStake/TurboStake/blob/master/src/kernel.cpp L13-L23
unsigned int nProtocolV03TestSwitchTime = 1359781000;
// Protocol switch time of v0.4 kernel protocol
unsigned int nProtocolV04SwitchTime = 1436585981;
unsigned int nProtocolV04TestSwitchTime = 1395700000;
unsigned int nProtocolV04UpgradeTime = 0;
// Switch time for new BIPs from bitcoin 0.16.x
const uint32_t nBTC16BIPsSwitchTime = 1559260800; // Fri 31 May 00:00:00 UTC 2019
// Hard checkpoints of stake modifiers to ensure they are deterministic
static std::map<int, unsigned int> mapStakeModifierCheckpoints =
boost::assign::map_list_of
( 0, 0x0e00670bu )
;
static std::map<int, unsigned int> mapStakeModifierTestnetCheckpoints =
boost::assign::map_list_of
( 0, 0x0e00670bu )
;
// Whether the given coinstake is subject to new v0.3 protocol
bool IsProtocolV03(unsigned int nTimeCoinStake)
{
return (nTimeCoinStake >= (Params().NetworkIDString() == CBaseChainParams::TESTNET ? nProtocolV03TestSwitchTime : nProtocolV03SwitchTime));
}
// Whether the given block is subject to new v0.4 protocol
bool IsProtocolV04(unsigned int nTimeBlock)
{
return (nTimeBlock >= (Params().NetworkIDString() == CBaseChainParams::TESTNET ? nProtocolV04TestSwitchTime : nProtocolV04SwitchTime));
}
// Dummy booleans (did not exist at time of legacy client)
bool IsProtocolV05(unsigned int nTimeTx)
{
return false;
}
bool IsProtocolV06(const CBlockIndex* pindexPrev)
{
return false;
}
bool IsProtocolV07(unsigned int nTimeTx)
{
return false;
}
bool IsBTC16BIPsEnabled(uint32_t nTimeTx)
{
return nTimeTx >= nBTC16BIPsSwitchTime;
}
// Get the last stake modifier and its generation time from a given block
static bool GetLastStakeModifier(const CBlockIndex* pindex, uint64_t& nStakeModifier, int64_t& nModifierTime)
{
if (!pindex)
return error("GetLastStakeModifier: null pindex");
while (pindex && pindex->pprev && !pindex->GeneratedStakeModifier())
pindex = pindex->pprev;
if (!pindex->GeneratedStakeModifier())
return error("GetLastStakeModifier: no generation at genesis block");
nStakeModifier = pindex->nStakeModifier;
nModifierTime = pindex->GetBlockTime();
return true;
}
// Get selection interval section (in seconds)
static int64_t GetStakeModifierSelectionIntervalSection(int nSection)
{
assert (nSection >= 0 && nSection < 64);
return (Params().GetConsensus().nModifierInterval * 63 / (63 + ((63 - nSection) * (MODIFIER_INTERVAL_RATIO - 1))));
}
// Get stake modifier selection interval (in seconds)
static int64_t GetStakeModifierSelectionInterval()
{
int64_t nSelectionInterval = 0;
for (int nSection=0; nSection<64; nSection++)
nSelectionInterval += GetStakeModifierSelectionIntervalSection(nSection);
return nSelectionInterval;
}
// select a block from the candidate blocks in vSortedByTimestamp, excluding
// already selected blocks in vSelectedBlocks, and with timestamp up to
// nSelectionIntervalStop.
static bool SelectBlockFromCandidates(
vector<pair<int64_t, uint256> >& vSortedByTimestamp,
map<uint256, const CBlockIndex*>& mapSelectedBlocks,
int64_t nSelectionIntervalStop, uint64_t nStakeModifierPrev,
const CBlockIndex** pindexSelected)
{
bool fSelected = false;
arith_uint256 hashBest = 0;
*pindexSelected = (const CBlockIndex*) 0;
for (const auto& item : vSortedByTimestamp)
{
if (!mapBlockIndex.count(item.second))
return error("SelectBlockFromCandidates: failed to find block index for candidate block %s", item.second.ToString());
const CBlockIndex* pindex = mapBlockIndex[item.second];
if (fSelected && pindex->GetBlockTime() > nSelectionIntervalStop)
break;
if (mapSelectedBlocks.count(pindex->GetBlockHash()) > 0)
continue;
// compute the selection hash by hashing its proof-hash and the
// previous proof-of-stake modifier
uint256 hashProof = pindex->IsProofOfStake()? pindex->hashProofOfStake : pindex->GetBlockHash();
CDataStream ss(SER_GETHASH, 0);
ss << hashProof << nStakeModifierPrev;
arith_uint256 hashSelection = UintToArith256(Hash(ss.begin(), ss.end()));
// the selection hash is divided by 2**32 so that proof-of-stake block
// is always favored over proof-of-work block. this is to preserve
// the energy efficiency property
if (pindex->IsProofOfStake())
hashSelection >>= 32;
if (fSelected && hashSelection < hashBest)
{
hashBest = hashSelection;
*pindexSelected = (const CBlockIndex*) pindex;
}
else if (!fSelected)
{
fSelected = true;
hashBest = hashSelection;
*pindexSelected = (const CBlockIndex*) pindex;
}
}
if (gArgs.GetBoolArg("-debug", false) && gArgs.GetBoolArg("-printstakemodifier", false))
LogPrintf("SelectBlockFromCandidates: selection hash=%s\n", hashBest.ToString());
return fSelected;
}
// Stake Modifier (hash modifier of proof-of-stake):
// The purpose of stake modifier is to prevent a txout (coin) owner from
// computing future proof-of-stake generated by this txout at the time
// of transaction confirmation. To meet kernel protocol, the txout
// must hash with a future stake modifier to generate the proof.
// Stake modifier consists of bits each of which is contributed from a
// selected block of a given block group in the past.
// The selection of a block is based on a hash of the block's proof-hash and
// the previous stake modifier.
// Stake modifier is recomputed at a fixed time interval instead of every
// block. This is to make it difficult for an attacker to gain control of
// additional bits in the stake modifier, even after generating a chain of
// blocks.
bool ComputeNextStakeModifier(const CBlockIndex* pindexCurrent, uint64_t &nStakeModifier, bool& fGeneratedStakeModifier)
{
const Consensus::Params& params = Params().GetConsensus();
const CBlockIndex* pindexPrev = pindexCurrent->pprev;
nStakeModifier = 0;
fGeneratedStakeModifier = false;
if (!pindexPrev)
{
fGeneratedStakeModifier = true;
return true; // genesis block's modifier is 0
}
// First find current stake modifier and its generation block time
// if it's not old enough, return the same stake modifier
int64_t nModifierTime = 0;
if (!GetLastStakeModifier(pindexPrev, nStakeModifier, nModifierTime))
return error("ComputeNextStakeModifier: unable to get last modifier");
if (gArgs.GetBoolArg("-debug", false))
LogPrintf("ComputeNextStakeModifier: prev modifier=0x%016x time=%s epoch=%u\n", nStakeModifier, DateTimeStrFormat(nModifierTime), (unsigned int)nModifierTime);
if (nModifierTime / params.nModifierInterval >= pindexPrev->GetBlockTime() / params.nModifierInterval)
{
if (gArgs.GetBoolArg("-debug", false))
LogPrintf("ComputeNextStakeModifier: no new interval keep current modifier: pindexPrev nHeight=%d nTime=%u\n", pindexPrev->nHeight, (unsigned int)pindexPrev->GetBlockTime());
return true;
}
if (nModifierTime / params.nModifierInterval >= pindexCurrent->GetBlockTime() / params.nModifierInterval)
{
// v0.4+ requires current block timestamp also be in a different modifier interval
if (IsProtocolV04(pindexCurrent->nTime))
{
if (gArgs.GetBoolArg("-debug", false))
LogPrintf("ComputeNextStakeModifier: (v0.4+) no new interval keep current modifier: pindexCurrent nHeight=%d nTime=%u\n", pindexCurrent->nHeight, (unsigned int)pindexCurrent->GetBlockTime());
return true;
}
else
{
if (gArgs.GetBoolArg("-debug", false))
LogPrintf("ComputeNextStakeModifier: v0.3 modifier at block %s not meeting v0.4+ protocol: pindexCurrent nHeight=%d nTime=%u\n", pindexCurrent->GetBlockHash().ToString(), pindexCurrent->nHeight, (unsigned int)pindexCurrent->GetBlockTime());
}
}
// Sort candidate blocks by timestamp
vector<pair<int64_t, uint256> > vSortedByTimestamp;
vSortedByTimestamp.reserve(64 * params.nModifierInterval / params.nStakeTargetSpacing);
int64_t nSelectionInterval = GetStakeModifierSelectionInterval();
int64_t nSelectionIntervalStart = (pindexPrev->GetBlockTime() / params.nModifierInterval) * params.nModifierInterval - nSelectionInterval;
const CBlockIndex* pindex = pindexPrev;
while (pindex && pindex->GetBlockTime() >= nSelectionIntervalStart)
{
vSortedByTimestamp.push_back(make_pair(pindex->GetBlockTime(), pindex->GetBlockHash()));
pindex = pindex->pprev;
}
int nHeightFirstCandidate = pindex ? (pindex->nHeight + 1) : 0;
// Shuffle before sort
for(int i = vSortedByTimestamp.size() - 1; i > 1; --i)
std::swap(vSortedByTimestamp[i], vSortedByTimestamp[GetRand(i)]);
sort(vSortedByTimestamp.begin(), vSortedByTimestamp.end(), [] (const pair<int64_t, uint256> &a, const pair<int64_t, uint256> &b)
{
if (a.first != b.first)
return a.first < b.first;
// Timestamp equals - compare block hashes
const uint32_t *pa = a.second.GetDataPtr();
const uint32_t *pb = b.second.GetDataPtr();
int cnt = 256 / 32;
do {
--cnt;
if (pa[cnt] != pb[cnt])
return pa[cnt] < pb[cnt];
} while(cnt);
return false; // Elements are equal
});
// Select 64 blocks from candidate blocks to generate stake modifier
uint64_t nStakeModifierNew = 0;
int64_t nSelectionIntervalStop = nSelectionIntervalStart;
map<uint256, const CBlockIndex*> mapSelectedBlocks;
for (int nRound=0; nRound<min(64, (int)vSortedByTimestamp.size()); nRound++)
{
// add an interval section to the current selection round
nSelectionIntervalStop += GetStakeModifierSelectionIntervalSection(nRound);
// select a block from the candidates of current round
if (!SelectBlockFromCandidates(vSortedByTimestamp, mapSelectedBlocks, nSelectionIntervalStop, nStakeModifier, &pindex))
return error("ComputeNextStakeModifier: unable to select block at round %d", nRound);
// write the entropy bit of the selected block
nStakeModifierNew |= (((uint64_t)pindex->GetStakeEntropyBit()) << nRound);
// add the selected block from candidates to selected list
mapSelectedBlocks.insert(make_pair(pindex->GetBlockHash(), pindex));
if (gArgs.GetBoolArg("-debug", false) && gArgs.GetBoolArg("-printstakemodifier", false))
LogPrintf("ComputeNextStakeModifier: selected round %d stop=%s height=%d bit=%d\n",
nRound, DateTimeStrFormat(nSelectionIntervalStop), pindex->nHeight, pindex->GetStakeEntropyBit());
}
// Print selection map for visualization of the selected blocks
if (gArgs.GetBoolArg("-debug", false) && gArgs.GetBoolArg("-printstakemodifier", false))
{
string strSelectionMap = "";
// '-' indicates proof-of-work blocks not selected
strSelectionMap.insert(0, pindexPrev->nHeight - nHeightFirstCandidate + 1, '-');
pindex = pindexPrev;
while (pindex && pindex->nHeight >= nHeightFirstCandidate)
{
// '=' indicates proof-of-stake blocks not selected
if (pindex->IsProofOfStake())
strSelectionMap.replace(pindex->nHeight - nHeightFirstCandidate, 1, "=");
pindex = pindex->pprev;
}
for (const auto& item : mapSelectedBlocks)
{
// 'S' indicates selected proof-of-stake blocks
// 'W' indicates selected proof-of-work blocks
strSelectionMap.replace(item.second->nHeight - nHeightFirstCandidate, 1, item.second->IsProofOfStake()? "S" : "W");
}
LogPrintf("ComputeNextStakeModifier: selection height [%d, %d] map %s\n", nHeightFirstCandidate, pindexPrev->nHeight, strSelectionMap);
}
if (gArgs.GetBoolArg("-debug", false))
LogPrintf("ComputeNextStakeModifier: new modifier=0x%016x time=%s\n", nStakeModifierNew, DateTimeStrFormat(pindexPrev->GetBlockTime()));
nStakeModifier = nStakeModifierNew;
fGeneratedStakeModifier = true;
return true;
}
// V0.3: Stake modifier used to hash for a stake kernel is chosen as the stake
// modifier about a selection interval later than the coin generating the kernel
static bool GetKernelStakeModifierV03(CBlockIndex* pindexPrev, uint256 hashBlockFrom, uint64_t& nStakeModifier, int& nStakeModifierHeight, int64_t& nStakeModifierTime, bool fPrintProofOfStake)
{
const Consensus::Params& params = Params().GetConsensus();
nStakeModifier = 0;
if (!mapBlockIndex.count(hashBlockFrom))
return error("GetKernelStakeModifier() : block not indexed");
const CBlockIndex* pindexFrom = mapBlockIndex[hashBlockFrom];
nStakeModifierHeight = pindexFrom->nHeight;
nStakeModifierTime = pindexFrom->GetBlockTime();
int64_t nStakeModifierSelectionInterval = GetStakeModifierSelectionInterval();
// we need to iterate index forward but we cannot depend on chainActive.Next()
// because there is no guarantee that we are checking blocks in active chain.
// So, we construct a temporary chain that we will iterate over.
// pindexFrom - this block contains coins that are used to generate PoS
// pindexPrev - this is a block that is previous to PoS block that we are checking, you can think of it as tip of our chain
std::vector<CBlockIndex*> tmpChain;
int32_t nDepth = pindexPrev->nHeight - (pindexFrom->nHeight-1); // -1 is used to also include pindexFrom
tmpChain.reserve(nDepth);
CBlockIndex* it = pindexPrev;
for (int i=1; i<=nDepth && !chainActive.Contains(it); i++) {
tmpChain.push_back(it);
it = it->pprev;
}
std::reverse(tmpChain.begin(), tmpChain.end());
size_t n = 0;
const CBlockIndex* pindex = pindexFrom;
// loop to find the stake modifier later by a selection interval
while (nStakeModifierTime < pindexFrom->GetBlockTime() + nStakeModifierSelectionInterval)
{
const CBlockIndex* old_pindex = pindex;
pindex = (!tmpChain.empty() && pindex->nHeight >= tmpChain[0]->nHeight - 1)? tmpChain[n++] : chainActive.Next(pindex);
if (n > tmpChain.size() || pindex == NULL) // check if tmpChain[n+1] exists
{ // reached best block; may happen if node is behind on block chain
if (fPrintProofOfStake || (old_pindex->GetBlockTime() + params.nStakeMinAge - nStakeModifierSelectionInterval > GetAdjustedTime()))
return error("GetKernelStakeModifier() : reached best block %s at height %d from block %s",
old_pindex->GetBlockHash().ToString(), old_pindex->nHeight, hashBlockFrom.ToString());
else
return false;
}
if (pindex->GeneratedStakeModifier())
{
nStakeModifierHeight = pindex->nHeight;
nStakeModifierTime = pindex->GetBlockTime();
}
}
nStakeModifier = pindex->nStakeModifier;
return true;
}
// Get the stake modifier specified by the protocol to hash for a stake kernel
static bool GetKernelStakeModifier(CBlockIndex* pindexPrev, uint256 hashBlockFrom, unsigned int nTimeTx, uint64_t& nStakeModifier, int& nStakeModifierHeight, int64_t& nStakeModifierTime, bool fPrintProofOfStake)
{
return GetKernelStakeModifierV03(pindexPrev, hashBlockFrom, nStakeModifier, nStakeModifierHeight, nStakeModifierTime, fPrintProofOfStake);
}
// turbostake kernel protocol
// coinstake must meet hash target according to the protocol:
// kernel (input 0) must meet the formula
// hash(nStakeModifier + txPrev.block.nTime + txPrev.offset + txPrev.nTime + txPrev.vout.n + nTime) < bnTarget * nCoinDayWeight
// this ensures that the chance of getting a coinstake is proportional to the
// amount of coin age one owns.
// The reason this hash is chosen is the following:
// nStakeModifier:
// (v0.5) uses dynamic stake modifier around 21 days before the kernel,
// versus static stake modifier about 9 days after the staked
// coin (txPrev) used in v0.3
// (v0.3) scrambles computation to make it very difficult to precompute
// future proof-of-stake at the time of the coin's confirmation
// (v0.2) nBits (deprecated): encodes all past block timestamps
// txPrev.block.nTime: prevent nodes from guessing a good timestamp to
// generate transaction for future advantage
// txPrev.offset: offset of txPrev inside block, to reduce the chance of
// nodes generating coinstake at the same time
// txPrev.nTime: reduce the chance of nodes generating coinstake at the same
// time
// txPrev.vout.n: output number of txPrev, to reduce the chance of nodes
// generating coinstake at the same time
// block/tx hash should not be used here as they can be generated in vast
// quantities so as to generate blocks faster, degrading the system back into
// a proof-of-work situation.
//
bool CheckStakeKernelHash(unsigned int nBits, CBlockIndex* pindexPrev, const CBlockHeader& blockFrom, unsigned int nTxPrevOffset, const CTransactionRef& txPrev, const COutPoint& prevout, unsigned int nTimeTx, uint256& hashProofOfStake, bool fPrintProofOfStake)
{
const Consensus::Params& params = Params().GetConsensus();
if (nTimeTx < txPrev->nTime) // Transaction timestamp violation
return error("CheckStakeKernelHash() : nTime violation");
unsigned int nTimeBlockFrom = blockFrom.GetBlockTime();
if (nTimeBlockFrom + params.nStakeMinAge > nTimeTx) // Min age requirement
return error("CheckStakeKernelHash() : min age violation");
CBigNum bnTargetPerCoinDay;
bnTargetPerCoinDay.SetCompact(nBits);
int64_t nValueIn = txPrev->vout[prevout.n].nValue;
// v0.3 protocol kernel hash weight starts from 0 at the 30-day min age
// this change increases active coins participating the hash and helps
// to secure the network when proof-of-stake difficulty is low
int64_t nTimeWeight = min((int64_t)nTimeTx - txPrev->nTime, params.nStakeMaxAge) - (IsProtocolV03(nTimeTx)? params.nStakeMinAge : 0);
CBigNum bnCoinDayWeight = CBigNum(nValueIn) * nTimeWeight / COIN / (24 * 60 * 60);
// Calculate hash
CDataStream ss(SER_GETHASH, 0);
uint64_t nStakeModifier = 0;
int nStakeModifierHeight = 0;
int64_t nStakeModifierTime = 0;
if (IsProtocolV03(nTimeTx)) // v0.3 protocol
{
if (!GetKernelStakeModifier(pindexPrev, blockFrom.GetHash(), nTimeTx, nStakeModifier, nStakeModifierHeight, nStakeModifierTime, fPrintProofOfStake))
return false;
ss << nStakeModifier;
}
else // v0.2 protocol
{
ss << nBits;
}
ss << nTimeBlockFrom << nTxPrevOffset << txPrev->nTime << prevout.n << nTimeTx;
hashProofOfStake = Hash(ss.begin(), ss.end());
LogPrintf("%s: modifier:%016x nTimeBlockFrom:%d nTimeTx:%d hash:%s\n", __func__, nStakeModifier, nTimeBlockFrom, nTimeTx, hashProofOfStake.GetHex());
if (fPrintProofOfStake)
{
if (IsProtocolV03(nTimeTx))
LogPrintf("CheckStakeKernelHash() : using modifier 0x%016x at height=%d timestamp=%s for block from height=%d timestamp=%s\n",
nStakeModifier, nStakeModifierHeight,
DateTimeStrFormat(nStakeModifierTime),
mapBlockIndex[blockFrom.GetHash()]->nHeight,
DateTimeStrFormat(blockFrom.GetBlockTime()));
LogPrintf("CheckStakeKernelHash() : check protocol=%s modifier=0x%016x nTimeBlockFrom=%u nTxPrevOffset=%u nTimeTxPrev=%u nPrevout=%u nTimeTx=%u hashProof=%s\n",
IsProtocolV03(nTimeTx)? "0.3" : "0.2",
IsProtocolV03(nTimeTx)? nStakeModifier : (uint64_t) nBits,
nTimeBlockFrom, nTxPrevOffset, txPrev->nTime, prevout.n, nTimeTx,
hashProofOfStake.ToString());
}
// Now check if proof-of-stake hash meets target protocol
if (CBigNum(hashProofOfStake) > bnCoinDayWeight * bnTargetPerCoinDay)
return false;
if (gArgs.GetBoolArg("-debug", false) && !fPrintProofOfStake)
{
if (IsProtocolV03(nTimeTx))
LogPrintf("CheckStakeKernelHash() : using modifier 0x%016x at height=%d timestamp=%s for block from height=%d timestamp=%s\n",
nStakeModifier, nStakeModifierHeight,
DateTimeStrFormat(nStakeModifierTime),
mapBlockIndex[blockFrom.GetHash()]->nHeight,
DateTimeStrFormat(blockFrom.GetBlockTime()));
LogPrintf("CheckStakeKernelHash() : pass protocol=%s modifier=0x%016x nTimeBlockFrom=%u nTxPrevOffset=%u nTimeTxPrev=%u nPrevout=%u nTimeTx=%u hashProof=%s\n",
IsProtocolV03(nTimeTx)? "0.3" : "0.2",
IsProtocolV03(nTimeTx)? nStakeModifier : (uint64_t) nBits,
nTimeBlockFrom, nTxPrevOffset, txPrev->nTime, prevout.n, nTimeTx,
hashProofOfStake.ToString());
}
return true;
}
// Check kernel hash target and coinstake signature
bool CheckProofOfStake(CValidationState &state, CBlockIndex* pindexPrev, const CTransactionRef& tx, unsigned int nBits, uint256& hashProofOfStake)
{
if (!tx->IsCoinStake())
return error("CheckProofOfStake() : called on non-coinstake %s", tx->GetHash().ToString());
// Kernel (input 0) must match the stake hash target per coin age (nBits)
const CTxIn& txin = tx->vin[0];
// Transaction index is required to get to block header
if (!fTxIndex)
return error("CheckProofOfStake() : transaction index not available");
// Get transaction index for the previous transaction
CDiskTxPos postx;
if (!pblocktree->ReadTxIndex(txin.prevout.hash, postx))
return error("CheckProofOfStake() : tx index not found"); // tx index not found
// Read txPrev and header of its block
CBlockHeader header;
CTransactionRef txPrev;
{
CAutoFile file(OpenBlockFile(postx, true), SER_DISK, CLIENT_VERSION);
try {
file >> header;
fseek(file.Get(), postx.nTxOffset, SEEK_CUR);
file >> txPrev;
} catch (std::exception &e) {
return error("%s() : deserialize or I/O error in CheckProofOfStake()", __PRETTY_FUNCTION__);
}
if (txPrev->GetHash() != txin.prevout.hash)
return error("%s() : txid mismatch in CheckProofOfStake()", __PRETTY_FUNCTION__);
}
if (!CheckStakeKernelHash(nBits, pindexPrev, header, postx.nTxOffset + CBlockHeader::NORMAL_SERIALIZE_SIZE, txPrev, txin.prevout, tx->nTime, hashProofOfStake, gArgs.GetBoolArg("-debug", false)))
return state.DoS(1, error("CheckProofOfStake() : INFO: check kernel failed on coinstake %s, hashProof=%s", tx->GetHash().ToString(), hashProofOfStake.ToString()));
return true;
}
// Check whether the coinstake timestamp meets protocol
bool CheckCoinStakeTimestamp(int64_t nTimeBlock, int64_t nTimeTx)
{
if (IsProtocolV03(nTimeTx)) // v0.3 protocol
return (nTimeBlock == nTimeTx);
else // v0.2 protocol
return ((nTimeTx <= nTimeBlock) && (nTimeBlock <= nTimeTx + MAX_FUTURE_BLOCK_TIME));
}
// Get stake modifier checksum
unsigned int GetStakeModifierChecksum(const CBlockIndex* pindex)
{
assert (pindex->pprev || pindex->GetBlockHash() == Params().GetConsensus().hashGenesisBlock);
// Hash previous checksum with flags, hashProofOfStake and nStakeModifier
CDataStream ss(SER_GETHASH, 0);
if (pindex->pprev)
ss << pindex->pprev->nStakeModifierChecksum;
ss << pindex->nFlags << pindex->hashProofOfStake << pindex->nStakeModifier;
arith_uint256 hashChecksum = UintToArith256(Hash(ss.begin(), ss.end()));
hashChecksum >>= (256 - 32);
return hashChecksum.GetLow64();
}
// Check stake modifier hard checkpoints
bool CheckStakeModifierCheckpoints(int nHeight, unsigned int nStakeModifierChecksum)
{
bool fTestNet = Params().NetworkIDString() == CBaseChainParams::TESTNET;
if (fTestNet && mapStakeModifierTestnetCheckpoints.count(nHeight))
return nStakeModifierChecksum == mapStakeModifierTestnetCheckpoints[nHeight];
if (!fTestNet && mapStakeModifierCheckpoints.count(nHeight))
return nStakeModifierChecksum == mapStakeModifierCheckpoints[nHeight];
return true;
}
bool IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned int nRequired, unsigned int nToCheck)
{
unsigned int nFound = 0;
for (unsigned int i = 0; i < nToCheck && nFound < nRequired && pstart != NULL; pstart = pstart->pprev )
{
if (!pstart->IsProofOfStake())
continue;
if (pstart->nVersion >= minVersion)
++nFound;
i++;
}
return (nFound >= nRequired);
}
// turbostake: entropy bit for stake modifier if chosen by modifier
unsigned int GetStakeEntropyBit(const CBlock& block)
{
unsigned int nEntropyBit = 0;
if (IsProtocolV04(block.nTime))
{
nEntropyBit = UintToArith256(block.GetHash()).GetLow64() & 1llu;// last bit of block hash
if (gArgs.GetBoolArg("-printstakemodifier", false))
LogPrintf("GetStakeEntropyBit(v0.4+): nTime=%u hashBlock=%s entropybit=%d\n", block.nTime, block.GetHash().ToString(), nEntropyBit);
}
else
{
// old protocol for entropy bit pre v0.4
uint160 hashSig = Hash160(block.vchBlockSig);
if (gArgs.GetBoolArg("-printstakemodifier", false))
LogPrintf("GetStakeEntropyBit(v0.3): nTime=%u hashSig=%s", block.nTime, hashSig.ToString());
nEntropyBit = hashSig.GetDataPtr()[4] >> 31; // take the first bit of the hash
if (gArgs.GetBoolArg("-printstakemodifier", false))
LogPrintf(" entropybit=%d\n", nEntropyBit);
}
return nEntropyBit;
}
|
// Copyright (c) 2009-2017 The Bitcoin Core developers
// Copyright (c) 2018-2018 The VERGE Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <consensus/tx_verify.h>
#include <consensus/consensus.h>
#include <primitives/transaction.h>
#include <script/interpreter.h>
#include <consensus/validation.h>
// TODO remove the following dependencies
#include <chain.h>
#include <coins.h>
#include <util/moneystr.h>
bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
{
if (tx.nLockTime == 0)
return true;
if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime))
return true;
for (const auto& txin : tx.vin) {
if (!(txin.nSequence == CTxIn::SEQUENCE_FINAL))
return false;
}
return true;
}
std::pair<int, int64_t> CalculateSequenceLocks(const CTransaction &tx, int flags, std::vector<int>* prevHeights, const CBlockIndex& block)
{
assert(prevHeights->size() == tx.vin.size());
// Will be set to the equivalent height- and time-based nLockTime
// values that would be necessary to satisfy all relative lock-
// time constraints given our view of block chain history.
// The semantics of nLockTime are the last invalid height/time, so
// use -1 to have the effect of any height or time being valid.
int nMinHeight = -1;
int64_t nMinTime = -1;
// tx.nVersion is signed integer so requires cast to unsigned otherwise
// we would be doing a signed comparison and half the range of nVersion
// wouldn't support BIP 68.
bool fEnforceBIP68 = static_cast<uint32_t>(tx.nVersion) >= 3
&& flags & LOCKTIME_VERIFY_SEQUENCE;
// Do not enforce sequence numbers as a relative lock time
// unless we have been instructed to
if (!fEnforceBIP68) {
return std::make_pair(nMinHeight, nMinTime);
}
for (size_t txinIndex = 0; txinIndex < tx.vin.size(); txinIndex++) {
const CTxIn& txin = tx.vin[txinIndex];
// Sequence numbers with the most significant bit set are not
// treated as relative lock-times, nor are they given any
// consensus-enforced meaning at this point.
if (txin.nSequence & CTxIn::SEQUENCE_LOCKTIME_DISABLE_FLAG) {
// The height of this input is not relevant for sequence locks
(*prevHeights)[txinIndex] = 0;
continue;
}
int nCoinHeight = (*prevHeights)[txinIndex];
if (txin.nSequence & CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG) {
int64_t nCoinTime = block.GetAncestor(std::max(nCoinHeight-1, 0))->GetMedianTimePast();
// NOTE: Subtract 1 to maintain nLockTime semantics
// BIP 68 relative lock times have the semantics of calculating
// the first block or time at which the transaction would be
// valid. When calculating the effective block time or height
// for the entire transaction, we switch to using the
// semantics of nLockTime which is the last invalid block
// time or height. Thus we subtract 1 from the calculated
// time or height.
// Time-based relative lock-times are measured from the
// smallest allowed timestamp of the block containing the
// txout being spent, which is the median time past of the
// block prior.
nMinTime = std::max(nMinTime, nCoinTime + (int64_t)((txin.nSequence & CTxIn::SEQUENCE_LOCKTIME_MASK) << CTxIn::SEQUENCE_LOCKTIME_GRANULARITY) - 1);
} else {
nMinHeight = std::max(nMinHeight, nCoinHeight + (int)(txin.nSequence & CTxIn::SEQUENCE_LOCKTIME_MASK) - 1);
}
}
return std::make_pair(nMinHeight, nMinTime);
}
bool EvaluateSequenceLocks(const CBlockIndex& block, std::pair<int, int64_t> lockPair)
{
assert(block.pprev);
int64_t nBlockTime = block.pprev->GetMedianTimePast();
if (lockPair.first >= block.nHeight || lockPair.second >= nBlockTime)
return false;
return true;
}
bool SequenceLocks(const CTransaction &tx, int flags, std::vector<int>* prevHeights, const CBlockIndex& block)
{
return EvaluateSequenceLocks(block, CalculateSequenceLocks(tx, flags, prevHeights, block));
}
unsigned int GetLegacySigOpCount(const CTransaction& tx)
{
unsigned int nSigOps = 0;
for (const auto& txin : tx.vin)
{
nSigOps += txin.scriptSig.GetSigOpCount(false);
}
for (const auto& txout : tx.vout)
{
nSigOps += txout.scriptPubKey.GetSigOpCount(false);
}
return nSigOps;
}
unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& inputs)
{
if (tx.IsCoinBase())
return 0;
unsigned int nSigOps = 0;
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
const Coin& coin = inputs.AccessCoin(tx.vin[i].prevout);
assert(!coin.IsSpent());
const CTxOut &prevout = coin.out;
if (prevout.scriptPubKey.IsPayToScriptHash())
nSigOps += prevout.scriptPubKey.GetSigOpCount(tx.vin[i].scriptSig);
}
return nSigOps;
}
int64_t GetTransactionSigOpCost(const CTransaction& tx, const CCoinsViewCache& inputs, int flags)
{
int64_t nSigOps = GetLegacySigOpCount(tx) * WITNESS_SCALE_FACTOR;
if (tx.IsCoinBase())
return nSigOps;
if (flags & SCRIPT_VERIFY_P2SH) {
nSigOps += GetP2SHSigOpCount(tx, inputs) * WITNESS_SCALE_FACTOR;
}
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
const Coin& coin = inputs.AccessCoin(tx.vin[i].prevout);
assert(!coin.IsSpent());
const CTxOut &prevout = coin.out;
nSigOps += CountWitnessSigOps(tx.vin[i].scriptSig, prevout.scriptPubKey, &tx.vin[i].scriptWitness, flags);
}
return nSigOps;
}
bool CheckTransaction(const CTransaction& tx, CValidationState &state, bool fCheckDuplicateInputs)
{
// Basic checks that don't depend on any context
if (tx.vin.empty())
return state.DoS(10, false, REJECT_INVALID, "bad-txns-vin-empty");
if (tx.vout.empty())
return state.DoS(10, false, REJECT_INVALID, "bad-txns-vout-empty");
// Size limits (this doesn't take the witness into account, as that hasn't been checked for malleability)
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-oversize");
// Check for negative or overflow output values
CAmount nValueOut = 0;
for (const auto& txout : tx.vout)
{
if (txout.nValue < 0)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-vout-negative");
if (txout.nValue > MAX_MONEY)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-vout-toolarge");
nValueOut += txout.nValue;
if (!MoneyRange(nValueOut))
return state.DoS(100, false, REJECT_INVALID, "bad-txns-txouttotal-toolarge");
}
// Check for duplicate inputs - note that this check is slow so we skip it in CheckBlock
if (fCheckDuplicateInputs) {
std::set<COutPoint> vInOutPoints;
for (const auto& txin : tx.vin)
{
if (!vInOutPoints.insert(txin.prevout).second)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-inputs-duplicate");
}
}
if (tx.IsCoinBase())
{
if (tx.vin[0].scriptSig.size() < 2 || tx.vin[0].scriptSig.size() > 100)
return state.DoS(100, false, REJECT_INVALID, "bad-cb-length");
}
else
{
for (const auto& txin : tx.vin)
if (txin.prevout.IsNull())
return state.DoS(10, false, REJECT_INVALID, "bad-txns-prevout-null");
}
return true;
}
bool Consensus::CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoinsViewCache& inputs, int nSpendHeight, CAmount& txfee)
{
// are the actual inputs available?
if (!inputs.HaveInputs(tx)) {
return state.DoS(100, false, REJECT_INVALID, "bad-txns-inputs-missingorspent", false,
strprintf("%s: inputs missing/spent", __func__));
}
CAmount nValueIn = 0;
for (unsigned int i = 0; i < tx.vin.size(); ++i) {
const COutPoint &prevout = tx.vin[i].prevout;
const Coin& coin = inputs.AccessCoin(prevout);
assert(!coin.IsSpent());
// If prev is coinbase, check that it's matured
if (coin.IsCoinBase() && nSpendHeight - coin.nHeight < COINBASE_MATURITY) {
return state.Invalid(false,
REJECT_INVALID, "bad-txns-premature-spend-of-coinbase",
strprintf("tried to spend coinbase at depth %d", nSpendHeight - coin.nHeight));
}
// check that previous inputs aren't newer than the tx itself
if (coin.nOriginTransactionTime > tx.nTime)
{
return state.DoS(100, false, REJECT_INVALID, "bad-txs-and-input-times", false,
strprintf("input-time (%s) > tx-time (%s)", coin.nOriginTransactionTime, tx.nTime));
}
// Check for negative or overflow input values
nValueIn += coin.out.nValue;
if (!MoneyRange(coin.out.nValue) || !MoneyRange(nValueIn)) {
return state.DoS(100, false, REJECT_INVALID, "bad-txns-inputvalues-outofrange");
}
}
const CAmount value_out = tx.GetValueOut();
if (nValueIn < value_out) {
return state.DoS(100, false, REJECT_INVALID, "bad-txns-in-belowout", false,
strprintf("value in (%s) < value out (%s)", FormatMoney(nValueIn), FormatMoney(value_out)));
}
// Tally transaction fees
const CAmount txfee_aux = nValueIn - value_out;
if (!MoneyRange(txfee_aux)) {
return state.DoS(100, false, REJECT_INVALID, "bad-txns-fee-outofrange");
}
txfee = txfee_aux;
return true;
}
|
/*=============================================================================
Copyright (c) 2011 Thomas Heller
Copyright (c) 2001-2011 Hartmut Kaiser
Copyright (c) 2011 Thomas Heller
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_SPIRIT_ARGUMENT_MARCH_22_2011_0939PM)
#define BOOST_SPIRIT_ARGUMENT_MARCH_22_2011_0939PM
#include <boost/spirit/include/phoenix_core.hpp>
namespace boost { namespace spirit
{
template <int N>
struct argument;
template <typename Dummy>
struct attribute_context;
namespace expression
{
#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
template <int N>
struct argument
{
typedef phoenix::actor<spirit::argument<N> > type;
static type make()
{
return spirit::argument<N>();
}
};
template <typename Dummy>
struct attribute_context
{
typedef phoenix::actor<spirit::attribute_context<Dummy> > type;
static type make()
{
return spirit::attribute_context<Dummy>();
}
};
#else
template <int N>
struct argument
: phoenix::expression::terminal<spirit::argument<N> >
{
typedef typename phoenix::expression::terminal<
spirit::argument<N>
>::type type;
static type make()
{
type const e = {{{}}};
return e;
}
};
template <typename Dummy>
struct attribute_context
: phoenix::expression::terminal<spirit::attribute_context<Dummy> >
{
typedef typename phoenix::expression::terminal<
spirit::attribute_context<Dummy>
>::type type;
static type make()
{
type const e = {{{}}};
return e;
}
};
#endif
}
}}
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
namespace boost { namespace phoenix
{
namespace result_of
{
template <typename Dummy>
struct is_nullary<custom_terminal<spirit::attribute_context<Dummy> > >
: mpl::false_
{};
template <int N>
struct is_nullary<custom_terminal<spirit::argument<N> > >
: mpl::false_
{};
}
template <typename Dummy>
struct is_custom_terminal<spirit::attribute_context<Dummy> >
: mpl::true_
{};
template <int N>
struct is_custom_terminal<spirit::argument<N> >
: mpl::true_
{};
template <typename Dummy>
struct custom_terminal<spirit::attribute_context<Dummy> >
: proto::call<
v2_eval(
proto::make<spirit::attribute_context<Dummy>()>
, proto::call<
functional::env(proto::_state)
>
)
>
{};
template <int N>
struct custom_terminal<spirit::argument<N> >
: proto::call<
v2_eval(
proto::make<spirit::argument<N>()>
, proto::call<
functional::env(proto::_state)
>
)
>
{};
}}
#endif // BOOST_SPIRIT_USE_PHOENIX_V3
#endif
|
//=================================================================================================
/*!
// \file src/mathtest/smatsvecmult/SCbVCa.cpp
// \brief Source file for the SCbVCa sparse matrix/sparse vector multiplication math test
//
// Copyright (C) 2012-2018 Klaus Iglberger - All Rights Reserved
//
// This file is part of the Blaze library. You can redistribute it and/or modify it under
// the terms of the New (Revised) BSD License. Redistribution and use in source and binary
// forms, with or without modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
// 3. Neither the names of the Blaze development group nor the names of its contributors
// may be used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
*/
//=================================================================================================
//*************************************************************************************************
// Includes
//*************************************************************************************************
#include <cstdlib>
#include <iostream>
#include <blaze/math/CompressedMatrix.h>
#include <blaze/math/CompressedVector.h>
#include <blaze/math/SymmetricMatrix.h>
#include <blazetest/mathtest/Creator.h>
#include <blazetest/mathtest/smatsvecmult/OperationTest.h>
#include <blazetest/system/MathTest.h>
//=================================================================================================
//
// MAIN FUNCTION
//
//=================================================================================================
//*************************************************************************************************
int main()
{
std::cout << " Running 'SCbVCa'..." << std::endl;
using blazetest::mathtest::TypeA;
using blazetest::mathtest::TypeB;
try
{
// Matrix type definitions
typedef blaze::SymmetricMatrix< blaze::CompressedMatrix<TypeB> > SCb;
typedef blaze::CompressedVector<TypeA> VCa;
// Creator type definitions
typedef blazetest::Creator<SCb> CSCb;
typedef blazetest::Creator<VCa> CVCa;
// Running tests with small matrices and vectors
for( size_t i=0UL; i<=6UL; ++i ) {
for( size_t j=0UL; j<=i*i; ++j ) {
for( size_t k=0UL; k<=i; ++k ) {
RUN_SMATSVECMULT_OPERATION_TEST( CSCb( i, j ), CVCa( i, k ) );
}
}
}
// Running tests with large matrices and vectors
RUN_SMATSVECMULT_OPERATION_TEST( CSCb( 67UL, 7UL ), CVCa( 67UL, 7UL ) );
RUN_SMATSVECMULT_OPERATION_TEST( CSCb( 127UL, 13UL ), CVCa( 127UL, 13UL ) );
RUN_SMATSVECMULT_OPERATION_TEST( CSCb( 64UL, 8UL ), CVCa( 64UL, 8UL ) );
RUN_SMATSVECMULT_OPERATION_TEST( CSCb( 128UL, 16UL ), CVCa( 128UL, 16UL ) );
}
catch( std::exception& ex ) {
std::cerr << "\n\n ERROR DETECTED during sparse matrix/sparse vector multiplication:\n"
<< ex.what() << "\n";
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
//*************************************************************************************************
|
#include "main/lsp/requests/initialize.h"
#include "main/lsp/json_types.h"
using namespace std;
namespace sorbet::realmain::lsp {
const std::vector<std::string> InitializeTask::TRIGGER_CHARACTERS = {".", ":", "@"};
InitializeTask::InitializeTask(LSPConfiguration &config, MessageId id, std::unique_ptr<InitializeParams> params)
: LSPRequestTask(config, id, LSPMethod::Initialize), mutableConfig(config), params(move(params)) {}
bool InitializeTask::canPreempt(const LSPIndexer &indexer) const {
return false;
}
void InitializeTask::preprocess(LSPPreprocessor &preprocessor) {
mutableConfig.setClientConfig(make_shared<LSPClientConfiguration>(*params));
}
unique_ptr<ResponseMessage> InitializeTask::runRequest(LSPTypecheckerInterface &ts) {
auto response = make_unique<ResponseMessage>("2.0", id, LSPMethod::Initialize);
const auto &opts = config.opts;
auto serverCap = make_unique<ServerCapabilities>();
serverCap->textDocumentSync = TextDocumentSyncKind::Full;
serverCap->definitionProvider = true;
serverCap->typeDefinitionProvider = true;
serverCap->documentSymbolProvider = opts.lspDocumentSymbolEnabled;
serverCap->workspaceSymbolProvider = true;
serverCap->documentHighlightProvider = opts.lspDocumentHighlightEnabled;
serverCap->hoverProvider = true;
serverCap->referencesProvider = true;
serverCap->implementationProvider = true;
serverCap->documentFormattingProvider = rubyfmt_enabled && opts.lspDocumentFormatRubyfmtEnabled;
serverCap->sorbetShowSymbolProvider = true;
auto codeActionProvider = make_unique<CodeActionOptions>();
codeActionProvider->codeActionKinds = {CodeActionKind::Quickfix, CodeActionKind::SourceFixAllSorbet};
if (opts.lspMoveMethodEnabled) {
codeActionProvider->codeActionKinds->push_back(CodeActionKind::RefactorExtract);
}
serverCap->codeActionProvider = move(codeActionProvider);
if (opts.lspSignatureHelpEnabled) {
auto sigHelpProvider = make_unique<SignatureHelpOptions>();
sigHelpProvider->triggerCharacters = {"(", ","};
serverCap->signatureHelpProvider = move(sigHelpProvider);
}
serverCap->renameProvider = make_unique<RenameOptions>(true);
auto completionProvider = make_unique<CompletionOptions>();
completionProvider->triggerCharacters = TRIGGER_CHARACTERS;
serverCap->completionProvider = move(completionProvider);
response->result = make_unique<InitializeResult>(move(serverCap));
return response;
}
} // namespace sorbet::realmain::lsp
|
/*
* Copyright 2008, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Alexandre Deckner <alex@zappotek.com>
*/
// Some math utils, useful for animation
#include "MathUtils.h"
#include <math.h>
float
MathUtils::EaseInOutCubic(float time, float start, float distance,
float duration)
{
time /= duration / 2.0;
if (time < 1.0)
return distance / 2.0 * time * time * time + start;
time -= 2.0;
return distance / 2.0 * (time * time * time + 2.0) + start;
}
float
MathUtils::EaseInOutQuart(float time, float start, float distance,
float duration)
{
time /= duration / 2;
if (time < 1)
return distance / 2 * time * time * time * time + start;
time -= 2;
return -distance / 2 * (time * time * time * time - 2) + start;
}
float
MathUtils::EaseInOutQuint(float time, float start, float distance,
float duration)
{
time /= duration / 2;
if (time < 1)
return distance / 2 * time * time * time * time * time + start;
time -= 2;
return distance / 2 *(time * time * time * time * time + 2) + start;
}
float
MathUtils::EaseInOutSine(float time, float start, float distance,
float duration)
{
return -distance / 2 * (cos(3.14159 * time / distance) - 1) + start;
}
|
//==================================================================================
// Copyright (c) 2016 , Advanced Micro Devices, Inc. All rights reserved.
//
/// \author AMD Developer Tools Team
/// \file dmnConfigManager.cpp
///
//==================================================================================
#include <sstream>
#include <exception>
#include <AMDTBaseTools/Include/AMDTDefinitions.h>
#include <AMDTOSWrappers/Include/osProcess.h>
#include <AMDTOSWrappers/Include/osFilePath.h>
#include <AMDTRemoteAgent/dmnConfigManager.h>
#include <AMDTRemoteAgent/Public Include/dmnStringConstants.h>
// Static definitions - BEGIN.
// Daemon config file name.
static const wchar_t* CONFIG_FILE_NAME = L"CodeXLRemoteAgentConfig.xml";
dmnConfigManager* dmnConfigManager::m_pInstance = NULL;
static const char* SETTINGS_ELEM_NAME = "Settings";
static const char* PORTNUM_ELEM_NAME = "PortNumber";
static const char* RD_TIMEOUT_ELEM_NAME = "ReadTimeoutMs";
static const char* WT_TIMEOUT_ELEM_NAME = "WriteTimeoutMs";
// Static definitions - END.
dmnConfigManager::dmnConfigManager(void) : m_portNumber(0), m_readTimeout(0), m_writeTimeout(0),
m_isInitialized(false), m_isPortNumExtracted(false),
m_isReadTimeoutExtracted(false), m_isWriteTimeoutExtracted(false)
{
}
dmnConfigManager::~dmnConfigManager(void)
{
if (m_pInstance != NULL)
{
delete m_pInstance;
}
}
unsigned int dmnConfigManager::GetPortNumber() const
{
return m_portNumber;
}
long dmnConfigManager::GetReadTimeout() const
{
return m_readTimeout;
}
long dmnConfigManager::GetWriteTimeout() const
{
return m_writeTimeout;
}
static bool IsPortNumElement(const std::string& elemName)
{
return (elemName.compare(PORTNUM_ELEM_NAME) == 0);
}
static bool IsReadTimeoutElement(const std::string& elemName)
{
return (elemName.compare(RD_TIMEOUT_ELEM_NAME) == 0);
}
static bool IsWriteTimeoutElement(const std::string& elemName)
{
return (elemName.compare(WT_TIMEOUT_ELEM_NAME) == 0);
}
static bool HandlePortNumberElement(const std::string& elemValue,
unsigned int& portNumBuffer)
{
gtString text;
bool ret = dmnUtils::ToGtString(elemValue, text);
GT_IF_WITH_ASSERT(ret)
{
ret = !text.startsWith(L"-");
GT_IF_WITH_ASSERT(ret)
{
ret = text.toUnsignedIntNumber(portNumBuffer);
GT_ASSERT(ret);
}
}
return ret;
}
static bool HandleTimeoutElement(const std::string& elemValue,
long& timeoutBuffer)
{
gtString text;
bool ret = dmnUtils::ToGtString(elemValue, text);
GT_IF_WITH_ASSERT(ret)
{
ret = text.toLongNumber(timeoutBuffer);
GT_IF_WITH_ASSERT(ret)
{
ret = timeoutBuffer >= DMN_MAX_TIMEOUT_VAL;
GT_ASSERT(ret);
}
}
return ret;
}
bool dmnConfigManager::handlePortNumElement(const std::string& elemValue)
{
m_isPortNumExtracted = m_isPortNumExtracted || HandlePortNumberElement(elemValue, m_portNumber);
return m_isPortNumExtracted;
}
bool dmnConfigManager::handleReadTimeoutElement(const std::string& elemValue)
{
m_isReadTimeoutExtracted = m_isReadTimeoutExtracted || HandleTimeoutElement(elemValue, m_readTimeout);
return m_isReadTimeoutExtracted;
}
bool dmnConfigManager::handleWriteTimeoutElement(const std::string& elemValue)
{
m_isWriteTimeoutExtracted = m_isWriteTimeoutExtracted || HandleTimeoutElement(elemValue, m_writeTimeout);
return m_isWriteTimeoutExtracted;
}
static void FillConfigFileNotFoundErrorMessage(std::wstring& buffer)
{
gtString errMessage;
errMessage.appendFormattedString(DMN_STR_ERR_CONFIG_FILE, CONFIG_FILE_NAME);
buffer = errMessage.asCharArray();
}
static void FillConfigFileCorruptedErrorMessage(std::wstring& buffer)
{
buffer = std::wstring(DMN_STR_ERR_CORRUPTED_CONFIG_FILE);
}
static void HandleConfigFileCorruptedScenario(std::wstring& errMessageBuffer)
{
FillConfigFileCorruptedErrorMessage(errMessageBuffer);
const std::string msg = DMN_STR_ERR_CORRUPTED_CONFIG_FILE_EXCPTION;
dmnUtils::LogMessage(msg, OS_DEBUG_LOG_ERROR);
}
bool dmnConfigManager::Init(std::wstring& errMsgBuffer)
{
// Do this only once.
if (m_isInitialized) { return true; }
// Load settings from config file.
bool isFailure = false;
// Open config file.
gtString configFilePath = L"";
isFailure = !dmnUtils::GetCurrentDirectory(configFilePath);
GT_ASSERT_EX(!isFailure, L"DMN: Failed extracting current directory to find config file.");
if (!isFailure)
{
gtASCIIString fileContent;
ReadConfigFile(configFilePath, fileContent);
TiXmlDocument doc;
doc.Parse(fileContent.asCharArray());
m_isInitialized = (false == doc.Error());
GT_IF_WITH_ASSERT(m_isInitialized)
{
TiXmlElement* pElement = doc.FirstChildElement();
GT_IF_WITH_ASSERT(pElement != NULL)
{
std::string val = pElement->Value();
m_isInitialized = (val.compare(SETTINGS_ELEM_NAME) == 0);
pElement = pElement->FirstChildElement();
m_isInitialized = pElement != NULL;
GT_IF_WITH_ASSERT(m_isInitialized)
{
for (; (pElement != NULL); pElement = pElement->NextSiblingElement())
{
GT_IF_WITH_ASSERT(pElement != NULL)
{
const char* elemNameTxt = pElement->Value();
isFailure = (elemNameTxt == NULL);
const char* elemValueTxt = pElement->GetText();
isFailure = isFailure || (elemValueTxt == NULL);
if (!isFailure)
{
const std::string elemName = pElement->Value();
const std::string elemValue = pElement->GetText();
// Handle the element.
isFailure = (IsPortNumElement(elemName) && !handlePortNumElement(elemValue)) ||
(IsReadTimeoutElement(elemName) && !handleReadTimeoutElement(elemValue)) ||
(IsWriteTimeoutElement(elemName) && !handleWriteTimeoutElement(elemValue));
// Break in case that the processing failed.
if (isFailure)
{
std::stringstream errMsg;
errMsg << "Failed to extract CodeXL Daemon configuration: <key, value> = <" <<
elemName << ", " << elemValue << ">. Exception will be thrown.";
dmnUtils::LogMessage(errMsg.str().c_str(), OS_DEBUG_LOG_ERROR);
FillConfigFileCorruptedErrorMessage(errMsgBuffer);
throw (std::exception());
}
}
else
{
HandleConfigFileCorruptedScenario(errMsgBuffer);
throw (std::exception());
}
}
else
{
HandleConfigFileCorruptedScenario(errMsgBuffer);
throw (std::exception());
}
}
}
}
}
else
{
FillConfigFileNotFoundErrorMessage(errMsgBuffer);
throw (std::exception());
}
}
else
{
FillConfigFileNotFoundErrorMessage(errMsgBuffer);
throw (std::exception());
}
m_isInitialized = (!isFailure) &&
m_isPortNumExtracted &&
m_isReadTimeoutExtracted &&
m_isWriteTimeoutExtracted;
if (!m_isInitialized)
{
// If we made it up to here, some configuration parameter missing.
std::stringstream errMsg;
errMsg << "Configuration parameter missing in " <<
CONFIG_FILE_NAME << ". Exception will be thrown.";
dmnUtils::LogMessage(errMsg.str().c_str(), OS_DEBUG_LOG_ERROR);
errMsgBuffer = DMN_STR_ERR_INVALID_CONFIG_FILE;
throw (std::exception());
}
return m_isInitialized;
}
void dmnConfigManager::ReadConfigFile(const gtString& configFilePath, gtASCIIString& fileContent) const
{
//Bug fix - Tiny xml can't open files with Unicode filePath, so we read the file into string
osFilePath configPath;
configPath.setFileDirectory(configFilePath);
configPath.setFileName(CONFIG_FILE_NAME);
osFile configFile(configPath);
bool isFileOpenOk = configFile.open(configPath, osChannel::OS_ASCII_TEXT_CHANNEL, osFile::OS_OPEN_TO_READ);
GT_ASSERT(isFileOpenOk);
configFile.readIntoString(fileContent);
GT_ASSERT(fileContent.length() > 0);
}
dmnConfigManager* dmnConfigManager::Instance()
{
if (m_pInstance == NULL)
{
m_pInstance = new(std::nothrow)dmnConfigManager();
}
return m_pInstance;
}
bool dmnConfigManager::TimeoutToString(long timeout, std::wstring& buffer) const
{
bool ret = true;
std::wstringstream stream;
try
{
if (timeout > 0)
{
stream << timeout;
}
else if (timeout == DMN_MAX_TIMEOUT_VAL)
{
stream << DMN_STR_INFO_INFINIE_TIMEOUT;
}
else
{
stream << DMN_STR_ERR_INVALID_TIMEOUT;
}
}
catch (...)
{
ret = false;
}
buffer = std::wstring(stream.str());
return ret;
}
bool dmnConfigManager::IsInternalVersion() const
{
#if AMDT_BUILD_ACCESS == AMDT_INTERNAL_ACCESS
return true;
#else
return false;
#endif
}
|
/*
* File: pr_loqo.c
* Purpose: solves quadratic programming problem for pattern recognition
* for support vectors
*
* Author: Alex J. Smola
* Created: 10/14/97
* Updated: 11/08/97
* Updated: 13/08/98 (removed exit(1) as it crashes svm lite when the margin
* in a not sufficiently conservative manner)
*
*
* Copyright (c) 1997 GMD Berlin - All rights reserved
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE of GMD Berlin
* The copyright notice above does not evidence any
* actual or intended publication of this work.
*
* Unauthorized commercial use of this software is not allowed
*/
#define PREDICTOR 1
#define CORRECTOR 2
#ifdef GLib_WIN
#pragma optimize( "", off )
#endif
/*****************************************************************
replace this by any other function that will exit gracefully
in a larger system
***************************************************************/
void TPrLoqo::nrerror(const char error_text[]) {
//printf("ERROR: terminating optimizer - %s\n", error_text);
/* exit(1); */
}
/*****************************************************************
taken from numerical recipes and modified to accept pointers
moreover numerical recipes code seems to be buggy (at least the
ones on the web)
cholesky solver and backsubstitution
leaves upper right triangle intact (rows first order)
***************************************************************/
void TPrLoqo::choldc(double a[], int n, double p[]) {
//void nrerror(char error_text[]);
int i, j, k;
double sum;
for (i = 0; i < n; i++){
for (j = i; j < n; j++) {
sum=a[n*i + j];
for (k=i-1; k>=0; k--) sum -= a[n*i + k]*a[n*j + k];
if (i == j) {
if (sum <= 0.0) {
nrerror("choldc failed, matrix not positive definite");
sum = 0.0;
}
p[i]=sqrt(sum);
} else a[n*j + i] = sum/p[i];
}
}
}
void TPrLoqo::cholsb(double a[], int n, double p[], double b[], double x[]) {
int i, k;
double sum;
for (i=0; i<n; i++) {
sum=b[i];
for (k=i-1; k>=0; k--) sum -= a[n*i + k]*x[k];
x[i]=sum/p[i];
}
for (i=n-1; i>=0; i--) {
sum=x[i];
for (k=i+1; k<n; k++) sum -= a[n*k + i]*x[k];
x[i]=sum/p[i];
}
}
/*****************************************************************
sometimes we only need the forward or backward pass of the
backsubstitution, hence we provide these two routines separately
***************************************************************/
void TPrLoqo::chol_forward(double a[], int n, double p[], double b[], double x[])
{
int i, k;
double sum;
for (i=0; i<n; i++) {
sum=b[i];
for (k=i-1; k>=0; k--) sum -= a[n*i + k]*x[k];
x[i]=sum/p[i];
}
}
void TPrLoqo::chol_backward(double a[], int n, double p[], double b[], double x[])
{
int i, k;
double sum;
for (i=n-1; i>=0; i--) {
sum=b[i];
for (k=i+1; k<n; k++) sum -= a[n*k + i]*x[k];
x[i]=sum/p[i];
}
}
/*****************************************************************
solves the system | -H_x A' | |x_x| = |c_x|
| A H_y| |x_y| |c_y|
with H_x (and H_y) positive (semidefinite) matrices
and n, m the respective sizes of H_x and H_y
for variables see pg. 48 of notebook or do the calculations on a
sheet of paper again
predictor solves the whole thing, corrector assues that H_x didn't
change and relies on the results of the predictor. therefore do
_not_ modify workspace
if you want to speed tune anything in the code here's the right
place to do so: about 95% of the time is being spent in
here. something like an iterative refinement would be nice,
especially when switching from double to single precision. if you
have a fast parallel cholesky use it instead of the numrec
implementations.
side effects: changes H_y (but this is just the unit matrix or zero anyway
in our case)
***************************************************************/
void TPrLoqo::solve_reduced(int n, int m, double h_x[], double h_y[],
double a[], double x_x[], double x_y[],
double c_x[], double c_y[],
double workspace[], int step)
{
int i,j,k;
double *p_x;
double *p_y;
double *t_a;
double *t_c;
double *t_y;
p_x = workspace; /* together n + m + n*m + n + m = n*(m+2)+2*m */
p_y = p_x + n;
t_a = p_y + m;
t_c = t_a + n*m;
t_y = t_c + n;
if (step == PREDICTOR) {
choldc(h_x, n, p_x); /* do cholesky decomposition */
for (i=0; i<m; i++) /* forward pass for A' */
chol_forward(h_x, n, p_x, a+i*n, t_a+i*n);
for (i=0; i<m; i++) /* compute (h_y + a h_x^-1A') */
for (j=i; j<m; j++)
for (k=0; k<n; k++)
h_y[m*i + j] += t_a[n*j + k] * t_a[n*i + k];
choldc(h_y, m, p_y); /* and cholesky decomposition */
}
chol_forward(h_x, n, p_x, c_x, t_c);
/* forward pass for c */
for (i=0; i<m; i++) { /* and solve for x_y */
t_y[i] = c_y[i];
for (j=0; j<n; j++)
t_y[i] += t_a[i*n + j] * t_c[j];
}
cholsb(h_y, m, p_y, t_y, x_y);
for (i=0; i<n; i++) { /* finally solve for x_x */
t_c[i] = -t_c[i];
for (j=0; j<m; j++)
t_c[i] += t_a[j*n + i] * x_y[j];
}
chol_backward(h_x, n, p_x, t_c, x_x);
}
/*****************************************************************
matrix vector multiplication (symmetric matrix but only one triangle
given). computes m*x = y
no need to tune it as it's only of O(n^2) but cholesky is of
O(n^3). so don't waste your time _here_ although it isn't very
elegant.
***************************************************************/
void TPrLoqo::matrix_vector(int n, double m[], double x[], double y[])
{
int i, j;
for (i=0; i<n; i++) {
y[i] = m[(n+1) * i] * x[i];
for (j=0; j<i; j++)
y[i] += m[i + n*j] * x[j];
for (j=i+1; j<n; j++)
y[i] += m[n*i + j] * x[j];
}
}
/*****************************************************************
call only this routine; this is the only one you're interested in
for doing quadratical optimization
the restart feature exists but it may not be of much use due to the
fact that an initial setting, although close but not very close the
the actual solution will result in very good starting diagnostics
(primal and dual feasibility and small infeasibility gap) but incur
later stalling of the optimizer afterwards as we have to enforce
positivity of the slacks.
***************************************************************/
int TPrLoqo::pr_loqo(int n, int m, double c[], double h_x[], double a[], double b[],
double l[], double u[], double primal[], double dual[],
int verb, double sigfig_max, int counter_max,
double margin, double bound, int restart)
{
/* the knobs to be tuned ... */
/* double margin = -0.95; we will go up to 95% of the
distance between old variables and zero */
/* double bound = 10; preset value for the start. small
values give good initial
feasibility but may result in slow
convergence afterwards: we're too
close to zero */
/* to be allocated */
double *workspace;
double *diag_h_x;
double *h_y;
double *c_x;
double *c_y;
double *h_dot_x;
double *rho;
double *nu;
double *tau;
double *sigma;
double *gamma_z;
double *gamma_s;
double *hat_nu;
double *hat_tau;
double *delta_x;
double *delta_y;
double *delta_s;
double *delta_z;
double *delta_g;
double *delta_t;
double *d;
/* from the header - pointers into primal and dual */
double *x;
double *y;
double *g;
double *z;
double *s;
double *t;
/* auxiliary variables */
double b_plus_1;
double c_plus_1;
double x_h_x;
double primal_inf;
double dual_inf;
double sigfig;
double primal_obj, dual_obj;
double mu;
double alfa = -1;//, step;
int counter = 0;
int status = STILL_RUNNING;
int i,j;//,k;
/* memory allocation */
workspace = (double *)malloc((n*(m+2)+2*m)*sizeof(double));
diag_h_x = (double *)malloc(n*sizeof(double));
h_y = (double *)malloc(m*m*sizeof(double));
c_x = (double *)malloc(n*sizeof(double));
c_y = (double *)malloc(m*sizeof(double));
h_dot_x = (double *)malloc(n*sizeof(double));
rho = (double *)malloc(m*sizeof(double));
nu = (double *)malloc(n*sizeof(double));
tau = (double *)malloc(n*sizeof(double));
sigma = (double *)malloc(n*sizeof(double));
gamma_z = (double *)malloc(n*sizeof(double));
gamma_s = (double *)malloc(n*sizeof(double));
hat_nu = (double *)malloc(n*sizeof(double));
hat_tau = (double *)malloc(n*sizeof(double));
delta_x = (double *)malloc(n*sizeof(double));
delta_y = (double *)malloc(m*sizeof(double));
delta_s = (double *)malloc(n*sizeof(double));
delta_z = (double *)malloc(n*sizeof(double));
delta_g = (double *)malloc(n*sizeof(double));
delta_t = (double *)malloc(n*sizeof(double));
d = (double *)malloc(n*sizeof(double));
/* pointers into the external variables */
x = primal; /* n */
g = x + n; /* n */
t = g + n; /* n */
y = dual; /* m */
z = y + m; /* n */
s = z + n; /* n */
/* initial settings */
b_plus_1 = 1;
c_plus_1 = 0;
for (i=0; i<n; i++) c_plus_1 += c[i];
/* get diagonal terms */
for (i=0; i<n; i++) diag_h_x[i] = h_x[(n+1)*i];
/* starting point */
if (restart == 1) {
/* x, y already preset */
for (i=0; i<n; i++) { /* compute g, t for primal feasibility */
g[i] = mx(fabs(x[i] - l[i]), bound);
t[i] = mx(fabs(u[i] - x[i]), bound);
}
matrix_vector(n, h_x, x, h_dot_x); /* h_dot_x = h_x * x */
for (i=0; i<n; i++) { /* sigma is a dummy variable to calculate z, s */
sigma[i] = c[i] + h_dot_x[i];
for (j=0; j<m; j++)
sigma[i] -= a[n*j + i] * y[j];
if (sigma[i] > 0) {
s[i] = bound;
z[i] = sigma[i] + bound;
}
else {
s[i] = bound - sigma[i];
z[i] = bound;
}
}
}
else { /* use default start settings */
for (i=0; i<m; i++)
for (j=i; j<m; j++)
h_y[i*m + j] = (i==j) ? 1 : 0;
for (i=0; i<n; i++) {
c_x[i] = c[i];
h_x[(n+1)*i] += 1;
}
for (i=0; i<m; i++)
c_y[i] = b[i];
/* and solve the system [-H_x A'; A H_y] [x, y] = [c_x; c_y] */
solve_reduced(n, m, h_x, h_y, a, x, y, c_x, c_y, workspace,
PREDICTOR);
/* initialize the other variables */
for (i=0; i<n; i++) {
g[i] = mx(fabs(x[i] - l[i]), bound);
z[i] = mx(fabs(x[i]), bound);
t[i] = mx(fabs(u[i] - x[i]), bound);
s[i] = mx(fabs(x[i]), bound);
}
}
for (i=0, mu=0; i<n; i++)
mu += z[i] * g[i] + s[i] * t[i];
mu = mu / (2*n);
/* the main loop */
if (verb >= STATUS) {
printf("counter | pri_inf | dual_inf | pri_obj | dual_obj | ");
printf("sigfig | alpha | nu \n");
printf("-------------------------------------------------------");
printf("---------------------------\n");
}
while (status == STILL_RUNNING) {
/* predictor */
/* put back original diagonal values */
for (i=0; i<n; i++)
h_x[(n+1) * i] = diag_h_x[i];
matrix_vector(n, h_x, x, h_dot_x); /* compute h_dot_x = h_x * x */
for (i=0; i<m; i++) {
rho[i] = b[i];
for (j=0; j<n; j++)
rho[i] -= a[n*i + j] * x[j];
}
for (i=0; i<n; i++) {
nu[i] = l[i] - x[i] + g[i];
tau[i] = u[i] - x[i] - t[i];
sigma[i] = c[i] - z[i] + s[i] + h_dot_x[i];
for (j=0; j<m; j++)
sigma[i] -= a[n*j + i] * y[j];
gamma_z[i] = - z[i];
gamma_s[i] = - s[i];
}
/* instrumentation */
x_h_x = 0;
primal_inf = 0;
dual_inf = 0;
for (i=0; i<n; i++) {
x_h_x += h_dot_x[i] * x[i];
primal_inf += sqr(tau[i]);
primal_inf += sqr(nu[i]);
dual_inf += sqr(sigma[i]);
}
for (i=0; i<m; i++)
primal_inf += sqr(rho[i]);
primal_inf = sqrt(primal_inf)/b_plus_1;
dual_inf = sqrt(dual_inf)/c_plus_1;
primal_obj = 0.5 * x_h_x;
dual_obj = -0.5 * x_h_x;
for (i=0; i<n; i++) {
primal_obj += c[i] * x[i];
dual_obj += l[i] * z[i] - u[i] * s[i];
}
for (i=0; i<m; i++)
dual_obj += b[i] * y[i];
sigfig = log10(fabs(primal_obj) + 1) -
log10(fabs(primal_obj - dual_obj));
sigfig = mx(sigfig, 0);
/* the diagnostics - after we computed our results we will
analyze them */
if (counter > counter_max) status = ITERATION_LIMIT;
if (sigfig > sigfig_max) status = OPTIMAL_SOLUTION;
if (primal_inf > 10e100) status = PRIMAL_INFEASIBLE;
if (dual_inf > 10e100) status = DUAL_INFEASIBLE;
if ((primal_inf > 10e100) & (dual_inf > 10e100)) status = PRIMAL_AND_DUAL_INFEASIBLE;
if (fabs(primal_obj) > 10e100) status = PRIMAL_UNBOUNDED;
if (fabs(dual_obj) > 10e100) status = DUAL_UNBOUNDED;
/* write some nice routine to enforce the time limit if you
_really_ want, however it's quite useless as you can compute
the time from the maximum number of iterations as every
iteration costs one cholesky decomposition plus a couple of
backsubstitutions */
/* generate report */
if ((verb >= FLOOD) | ((verb == STATUS) & (status != 0)))
printf("%7i | %.2e | %.2e | % .2e | % .2e | %6.3f | %.4f | %.2e\n",
counter, primal_inf, dual_inf, primal_obj, dual_obj,
sigfig, alfa, mu);
counter++;
if (status == 0) { /* we may keep on going, otherwise
it'll cost one loop extra plus a
messed up main diagonal of h_x */
/* intermediate variables (the ones with hat) */
for (i=0; i<n; i++) {
hat_nu[i] = nu[i] + g[i] * gamma_z[i] / z[i];
hat_tau[i] = tau[i] - t[i] * gamma_s[i] / s[i];
/* diagonal terms */
d[i] = z[i] / g[i] + s[i] / t[i];
}
/* initialization before the cholesky solver */
for (i=0; i<n; i++) {
h_x[(n+1)*i] = diag_h_x[i] + d[i];
c_x[i] = sigma[i] - z[i] * hat_nu[i] / g[i] -
s[i] * hat_tau[i] / t[i];
}
for (i=0; i<m; i++) {
c_y[i] = rho[i];
for (j=i; j<m; j++)
h_y[m*i + j] = 0;
}
/* and do it */
solve_reduced(n, m, h_x, h_y, a, delta_x, delta_y, c_x, c_y, workspace,
PREDICTOR);
for (i=0; i<n; i++) {
/* backsubstitution */
delta_s[i] = s[i] * (delta_x[i] - hat_tau[i]) / t[i];
delta_z[i] = z[i] * (hat_nu[i] - delta_x[i]) / g[i];
delta_g[i] = g[i] * (gamma_z[i] - delta_z[i]) / z[i];
delta_t[i] = t[i] * (gamma_s[i] - delta_s[i]) / s[i];
/* central path (corrector) */
gamma_z[i] = mu / g[i] - z[i] - delta_z[i] * delta_g[i] / g[i];
gamma_s[i] = mu / t[i] - s[i] - delta_s[i] * delta_t[i] / t[i];
/* (some more intermediate variables) the hat variables */
hat_nu[i] = nu[i] + g[i] * gamma_z[i] / z[i];
hat_tau[i] = tau[i] - t[i] * gamma_s[i] / s[i];
/* initialization before the cholesky */
c_x[i] = sigma[i] - z[i] * hat_nu[i] / g[i] - s[i] * hat_tau[i] / t[i];
}
for (i=0; i<m; i++) { /* comput c_y and rho */
c_y[i] = rho[i];
for (j=i; j<m; j++)
h_y[m*i + j] = 0;
}
/* and do it */
solve_reduced(n, m, h_x, h_y, a, delta_x, delta_y, c_x, c_y, workspace,
CORRECTOR);
for (i=0; i<n; i++) {
/* backsubstitution */
delta_s[i] = s[i] * (delta_x[i] - hat_tau[i]) / t[i];
delta_z[i] = z[i] * (hat_nu[i] - delta_x[i]) / g[i];
delta_g[i] = g[i] * (gamma_z[i] - delta_z[i]) / z[i];
delta_t[i] = t[i] * (gamma_s[i] - delta_s[i]) / s[i];
}
alfa = -1;
for (i=0; i<n; i++) {
alfa = mn(alfa, delta_g[i]/g[i]);
alfa = mn(alfa, delta_t[i]/t[i]);
alfa = mn(alfa, delta_s[i]/s[i]);
alfa = mn(alfa, delta_z[i]/z[i]);
}
alfa = (margin - 1) / alfa;
/* compute mu */
for (i=0, mu=0; i<n; i++)
mu += z[i] * g[i] + s[i] * t[i];
mu = mu / (2*n);
mu = mu * sqr((alfa - 1) / (alfa + 10));
for (i=0; i<n; i++) {
x[i] += alfa * delta_x[i];
g[i] += alfa * delta_g[i];
t[i] += alfa * delta_t[i];
z[i] += alfa * delta_z[i];
s[i] += alfa * delta_s[i];
}
for (i=0; i<m; i++)
y[i] += alfa * delta_y[i];
}
}
if ((status == 1) && (verb >= STATUS)) {
printf("----------------------------------------------------------------------------------\n");
printf("optimization converged\n");
}
/* free memory */
free(workspace);
free(diag_h_x);
free(h_y);
free(c_x);
free(c_y);
free(h_dot_x);
free(rho);
free(nu);
free(tau);
free(sigma);
free(gamma_z);
free(gamma_s);
free(hat_nu);
free(hat_tau);
free(delta_x);
free(delta_y);
free(delta_s);
free(delta_z);
free(delta_g);
free(delta_t);
free(d);
/* and return to sender */
return status;
}
#ifdef GLib_WIN
#pragma optimize( "", on )
#endif
|
/******************************************************************************/
/* */
/* Copyright (c) 2010, 2014 Sylwester Wysocki <sw143@wp.pl> */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining a */
/* copy of this software and associated documentation files (the "Software"), */
/* to deal in the Software without restriction, including without limitation */
/* the rights to use, copy, modify, merge, publish, distribute, sublicense, */
/* and/or sell copies of the Software, and to permit persons to whom the */
/* Software is furnished to do so, subject to the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be included in */
/* all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL */
/* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER */
/* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER */
/* DEALINGS IN THE SOFTWARE. */
/* */
/******************************************************************************/
#include <Tegenaria/Str.h>
#include <cstdio>
using namespace Tegenaria;
//
// Encode example values into binary packet:
//
// offset length descritpion
// 0 1 some 8-bit value
// 1 4 some 32-bit value
// 5 8 some 64-bit value
// 13 4 size of string
// 17 ... string data with zero terminator
//
void EncodePacket(string &packet,
uint8_t value8,
uint32_t value32,
uint64_t value64,
const char *valueString)
{
StrPushByte(packet, value8);
StrPushDword(packet, value32);
StrPushQword(packet, value64);
StrPushString(packet, valueString);
printf("Encoded packet is:\n");
printf(" value8 : [%d].\n", value8);
printf(" value32 : [%d].\n", value32);
printf(" value64 : [%"PRId64"].\n", value64);
printf(" string : [%s].\n\n", valueString);
}
//
// Decode packet back. This function emulate decoding packet
// e.g. just after receiving it from network, where we get raw {buf, len}
// buffer.
//
int DecodePacket(const void *buf, int len)
{
int exitCode = -1;
uint8_t value8 = 0;
uint32_t value32 = 0;
uint64_t value64 = 0;
const char *valueString = NULL;
//
// Pointer to track current position in buffer.
//
char *it = (char *) buf;
int bytesLeft = len;
//
// Decode.
//
FAIL(StrPopByte(&value8, &it, &bytesLeft));
FAIL(StrPopDword(&value32, &it, &bytesLeft));
FAIL(StrPopQword(&value64, &it, &bytesLeft));
FAIL(StrPopString(&valueString, NULL, &it, &bytesLeft));
//
// Print back decoded packet.
//
printf("Decoded packet is:\n");
printf(" value8 : [%d].\n", value8);
printf(" value32 : [%d].\n", value32);
printf(" value64 : [%"PRId64"].\n", value64);
printf(" string : [%s].\n\n", valueString);
//
// Error handler.
//
exitCode = 0;
fail:
if (exitCode)
{
Error("ERROR: Cannot decode packet.\n");
}
}
int main(int argc, char **argv)
{
string packet;
//
// Encode some data into packet.
//
EncodePacket(packet, 1, 2, 3, "hello");
//
// Decode it back.
//
DecodePacket(packet.c_str(), packet.size());
return 0;
}
|
// System::Web::Services::Description.SoapHeaderBinding
/*
The following example demonstrates the class 'SoapHeaderBinding'.
It takes as input a wsdl file. By using the 'Read' method
of 'ServiceDescription' class it gets a 'ServiceDescription' object.
It uses the SOAP protocol related classes and creates 'Binding' element
of 'SOAP' protocol which are then added to the 'ServiceDescription' object.
An output wsdl file is generated from 'ServiceDescription' object which
could be used for generating a proxy.
*/
// <Snippet1>
#using <System.dll>
#using <System.Web.Services.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Collections;
using namespace System::Xml;
int main()
{
ServiceDescription^ myServiceDescription = ServiceDescription::Read( "SoapHeaderBindingInput_cpp.wsdl" );
Binding^ myBinding = gcnew Binding;
myBinding->Name = "MyWebServiceSoap";
myBinding->Type = gcnew XmlQualifiedName( "s0:MyWebServiceSoap" );
SoapBinding^ mySoapBinding = gcnew SoapBinding;
mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http";
mySoapBinding->Style = SoapBindingStyle::Document;
myBinding->Extensions->Add( mySoapBinding );
OperationBinding^ myOperationBinding = gcnew OperationBinding;
myOperationBinding->Name = "Hello";
SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding;
mySoapOperationBinding->SoapAction = "http://tempuri.org/Hello";
mySoapOperationBinding->Style = SoapBindingStyle::Document;
myOperationBinding->Extensions->Add( mySoapOperationBinding );
// Create InputBinding for operation for the 'SOAP' protocol.
InputBinding^ myInputBinding = gcnew InputBinding;
SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding;
mySoapBodyBinding->Use = SoapBindingUse::Literal;
myInputBinding->Extensions->Add( mySoapBodyBinding );
SoapHeaderBinding^ mySoapHeaderBinding = gcnew SoapHeaderBinding;
mySoapHeaderBinding->Message = gcnew XmlQualifiedName( "s0:HelloMyHeader" );
mySoapHeaderBinding->Part = "MyHeader";
mySoapHeaderBinding->Use = SoapBindingUse::Literal;
// Add mySoapHeaderBinding to 'myInputBinding' object.
myInputBinding->Extensions->Add( mySoapHeaderBinding );
// Create OutputBinding for operation for the 'SOAP' protocol.
OutputBinding^ myOutputBinding = gcnew OutputBinding;
myOutputBinding->Extensions->Add( mySoapBodyBinding );
// Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'.
myOperationBinding->Input = myInputBinding;
myOperationBinding->Output = myOutputBinding;
myBinding->Operations->Add( myOperationBinding );
myServiceDescription->Bindings->Add( myBinding );
myServiceDescription->Write( "SoapHeaderBindingOut_cpp.wsdl" );
Console::WriteLine( "'SoapHeaderBindingOut_cpp.wsdl' file is generated." );
Console::WriteLine( "Proxy could be created using 'wsdl SoapHeaderBindingOut_cpp.wsdl'." );
}
// </Snippet1>
|
#include "Shader.hh"
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <sstream>
#include <glow/glow.hh>
#include <glow/util/DefaultShaderParser.hh>
#include <glow/common/log.hh>
#include <glow/common/profiling.hh>
#include <glow/common/shader_endings.hh>
#include <glow/common/str_utils.hh>
#include <glow/common/stream_readall.hh>
using namespace glow;
SharedShaderParser Shader::sParser = std::make_shared<DefaultShaderParser>();
Shader::Shader(GLenum shaderType) : mType(shaderType)
{
checkValidGLOW();
mObjectName = glCreateShader(mType);
}
Shader::~Shader()
{
checkValidGLOW();
glDeleteShader(mObjectName);
}
void Shader::compile()
{
checkValidGLOW();
GLOW_ACTION();
glCompileShader(mObjectName);
// check error log
GLint logLength = 0;
glGetShaderiv(mObjectName, GL_INFO_LOG_LENGTH, &logLength);
if (logLength > 1)
{
std::string logOutput;
{
std::vector<GLchar> log;
log.resize(static_cast<unsigned>(logLength) + 1u);
glGetShaderInfoLog(mObjectName, logLength + 1, nullptr, log.data());
logOutput = std::string(log.data());
}
error() << "Log for " << (mFileName.empty() ? to_string(this) : mFileName);
error() << "Shader compiler: " << logOutput;
mHasErrors = true;
mCompiled = false; // is this true?
// Check if NVidia-style line information is present in the log
if (strncmp(logOutput.c_str(), "0(", 2) == 0)
{
auto it = logOutput.begin() + 2;
while (isdigit(*it))
++it;
auto const lineNumberString = std::string(logOutput.begin() + 2, it);
auto const lineNumber = strtoul(lineNumberString.data(), nullptr, 0);
if (lineNumber != 0)
{
// Found a line number
unsigned readLineNumber = 1;
std::stringstream sourceStream(mSources.at(0));
for (; readLineNumber < lineNumber - 1; ++readLineNumber)
sourceStream.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
std::string line;
line.reserve(256);
error() << "Source provoking error:";
for (auto num = (readLineNumber != 1) ? 0 : 1; std::getline(sourceStream, line, '\n') && num < 3; ++readLineNumber, ++num)
error() << readLineNumber << " | " << line;
}
}
}
else
{
mHasErrors = false;
mCompiled = true;
}
}
void Shader::reload()
{
GLOW_ACTION();
// reload source
if (!mFileName.empty())
{
std::ifstream file(mFileName);
if (!file.good())
{
warning() << "Skipping reload for " << mFileName << ", file not readable. " << to_string(this);
return;
}
setSource(util::readall(file));
mFileFlag->clear();
}
// compile
compile();
}
void Shader::setSource(std::string_view source) { setSource(std::vector<std::string>({std::string(source)})); }
void Shader::setSource(const std::vector<std::string>& sources)
{
checkValidGLOW();
mDependencyFlags.clear();
mSources = sources;
auto parsedSources = sParser ? sParser->parse(this, sources) : sources;
std::vector<const GLchar*> srcs;
srcs.resize(parsedSources.size());
for (auto i = 0u; i < parsedSources.size(); ++i)
srcs[i] = parsedSources[i].c_str();
glShaderSource(mObjectName, static_cast<GLint>(srcs.size()), srcs.data(), nullptr);
}
SharedShader Shader::createFromSource(GLenum shaderType, std::string_view source)
{
GLOW_ACTION();
auto shader = std::make_shared<Shader>(shaderType);
shader->setSource(source);
shader->compile();
return shader;
}
SharedShader Shader::createFromSource(GLenum shaderType, const std::vector<std::string>& sources)
{
GLOW_ACTION();
auto shader = std::make_shared<Shader>(shaderType);
shader->setSource(sources);
shader->compile();
return shader;
}
SharedShader Shader::createFromSource(GLenum shaderType, const unsigned char source[])
{
std::stringstream ss;
ss << source;
return createFromSource(shaderType, ss.str());
}
#include <codecvt>
#include <locale>
#include <string>
SharedShader Shader::createFromFile(GLenum shaderType, std::string_view filename)
{
GLOW_ACTION();
auto shaderFile = std::ifstream(std::string(filename));
if (!shaderFile.good())
{
error() << "Unable to read shader file " << filename;
return nullptr;
}
auto shader = std::make_shared<Shader>(shaderType);
shader->setObjectLabel(filename);
shader->mFileName = filename;
shader->mFileFlag = FileWatch::watchFile(filename);
shader->setSource(util::readall(shaderFile));
shader->compile();
return shader;
}
bool Shader::newerVersionAvailable()
{
// Main file changes
if (mFileFlag && mFileFlag->isChanged())
return true;
// Dependency changes
for (auto const& dep : mDependencyFlags)
if (dep->isChanged())
return true;
return false;
}
void Shader::setShaderParser(const SharedShaderParser& parser) { sParser = parser; }
bool Shader::resolveFile(std::string_view name, GLenum& shaderType, std::string& content, std::string& realFileName)
{
if (sParser)
return sParser->resolveFile(name, shaderType, content, realFileName);
// no parser: fallback
// detect shader type
auto found = false;
for (auto const& kvp : glow::shaderEndingToType)
if (util::endswith(name, kvp.first))
{
shaderType = kvp.second;
found = true;
break;
}
// direct match
if (std::ifstream(std::string(name)).good())
{
if (!found) // has to be done here, because non-existant files should fail silently
{
error() << "Could not deduce shader type of Shader file " << name << ".";
return false;
}
realFileName = name;
std::ifstream fs(realFileName);
content = util::readall(fs);
return true;
}
return false;
}
void Shader::addDependency(std::string_view filename)
{
// Multiple adds of the same dependency will just result in aliased shared_ptrs,
// not worth storing and comparing std::strings per dependency
mDependencyFlags.push_back(FileWatch::watchFile(filename));
}
|
/*
* This work is part of the Core Imaging Library developed by
* Visual Analytics and Imaging System Group of the Science Technology
* Facilities Council, STFC
*
* Copyright 2017 Daniil Kazantsev
* Copyright 2017 Srikanth Nagella, Edoardo Pasca
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "matrix.h"
#include "mex.h"
#include "LLT_ROF_GPU_core.h"
/* CUDA implementation of Lysaker, Lundervold and Tai (LLT) model [1] combined with Rudin-Osher-Fatemi [2] TV regularisation penalty.
*
* This penalty can deliver visually pleasant piecewise-smooth recovery if regularisation parameters are selected well.
* The rule of thumb for selection is to start with lambdaLLT = 0 (just the ROF-TV model) and then proceed to increase
* lambdaLLT starting with smaller values.
*
* Input Parameters:
* 1. U0 - original noise image/volume
* 2. lambdaROF - ROF-related regularisation parameter
* 3. lambdaLLT - LLT-related regularisation parameter
* 4. tau - time-marching step
* 5. iter - iterations number (for both models)
* 6. eplsilon - tolerance constant [OPTIONAL parameter]
*
* Output:
* [1] Regularized image/volume
* [2] Information vector which contains [iteration no., reached tolerance]
*
* References:
* [1] Lysaker, M., Lundervold, A. and Tai, X.C., 2003. Noise removal using fourth-order partial differential equation with applications to medical magnetic resonance images in space and time. IEEE Transactions on image processing, 12(12), pp.1579-1590.
* [2] Rudin, Osher, Fatemi, "Nonlinear Total Variation based noise removal algorithms"
*/
void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
int number_of_dims, iterationsNumb;
mwSize dimX, dimY, dimZ;
const mwSize *dim_array;
float *Input, *Output=NULL, lambdaROF, lambdaLLT, tau, epsil;
float *infovec=NULL;
dim_array = mxGetDimensions(prhs[0]);
number_of_dims = mxGetNumberOfDimensions(prhs[0]);
if ((nrhs < 3) || (nrhs > 6)) mexErrMsgTxt("At least 3 parameters is required, all parameters are: Image(2D/3D), Regularisation parameter (ROF), Regularisation parameter (LTT), iterations number, time-marching parameter, tolerance");
/*Handling Matlab input data*/
Input = (float *) mxGetData(prhs[0]);
lambdaROF = (float) mxGetScalar(prhs[1]); /* ROF regularization parameter */
lambdaLLT = (float) mxGetScalar(prhs[2]); /* ROF regularization parameter */
iterationsNumb = 250;
tau = 0.0025;
epsil = 1.0e-06; /*tolerance parameter*/
if (mxGetClassID(prhs[0]) != mxSINGLE_CLASS) {mexErrMsgTxt("The input image must be in a single precision"); }
if ((nrhs == 4) || (nrhs == 5) || (nrhs == 6)) iterationsNumb = (int) mxGetScalar(prhs[3]); /* iterations number */
if ((nrhs == 5) || (nrhs == 6)) tau = (float) mxGetScalar(prhs[4]); /* marching step parameter */
if (nrhs == 6) epsil = (float) mxGetScalar(prhs[5]); /* epsilon */
/*Handling Matlab output data*/
dimX = dim_array[0]; dimY = dim_array[1]; dimZ = dim_array[2];
/* output arrays*/
if (number_of_dims == 2) {
dimZ = 1; /*2D case*/
/* output image/volume */
Output = (float*)mxGetPr(plhs[0] = mxCreateNumericArray(2, dim_array, mxSINGLE_CLASS, mxREAL));
}
if (number_of_dims == 3) Output = (float*)mxGetPr(plhs[0] = mxCreateNumericArray(3, dim_array, mxSINGLE_CLASS, mxREAL));
mwSize vecdim[1];
vecdim[0] = 2;
infovec = (float*)mxGetPr(plhs[1] = mxCreateNumericArray(1, vecdim, mxSINGLE_CLASS, mxREAL));
LLT_ROF_GPU_main(Input, Output, infovec, lambdaROF, lambdaLLT, iterationsNumb, tau, epsil, dimX, dimY, dimZ);
}
|
#include <string>
#include <BWAPI/TechType.h>
#include <BWAPI/Race.h>
#include <BWAPI/Order.h>
#include <BWAPI/UnitType.h>
#include <BWAPI/WeaponType.h>
#include "../../Debug.h"
namespace BWAPI
{
// NAMES
template <>
const std::string Type<TechType, TechTypes::Enum::Unknown>::typeNames[TechTypes::Enum::MAX] =
{
"Stim_Packs",
"Lockdown",
"EMP_Shockwave",
"Spider_Mines",
"Scanner_Sweep",
"Tank_Siege_Mode",
"Defensive_Matrix",
"Irradiate",
"Yamato_Gun",
"Cloaking_Field",
"Personnel_Cloaking",
"Burrowing",
"Infestation",
"Spawn_Broodlings",
"Dark_Swarm",
"Plague",
"Consume",
"Ensnare",
"Parasite",
"Psionic_Storm",
"Hallucination",
"Recall",
"Stasis_Field",
"Archon_Warp",
"Restoration",
"Disruption_Web",
"",
"Mind_Control",
"Dark_Archon_Meld",
"Feedback",
"Optical_Flare",
"Maelstrom",
"Lurker_Aspect",
"",
"Healing",
"", "", "", "", "", "", "", "", "",
"None",
"Nuclear_Strike",
"Unknown"
};
// LOCALIZATION
std::string techLocalNames[TechTypes::Enum::MAX];
// DEFAULTS
static const int defaultOreCost[TechTypes::Enum::MAX] = // Same as default gas cost
{ 100, 200, 200, 100, 0, 150, 0, 200, 100, 150, 100, 100, 0, 100, 0, 200, 100, 100, 0, 200, 150, 150, 150, 0, 100, 200, 0, 200, 0, 100, 100, 100, 200 };
static const int defaultTimeCost[TechTypes::Enum::MAX] =
{ 1200, 1500, 1800, 1200, 0, 1200, 0, 1200, 1800, 1500, 1200, 1200, 0, 1200, 0, 1500, 1500, 1200, 0, 1800, 1200, 1800, 1500, 0, 1200, 1200, 0, 1800, 0, 1800, 1800, 1500, 1800 };
static const int defaultEnergyCost[TechTypes::Enum::MAX] =
{ 0, 100, 100, 0, 50, 0, 100, 75, 150, 25, 25, 0, 0, 150, 100, 150, 0, 75, 75, 75, 100, 150, 100, 0, 50, 125, 0, 150, 0, 50, 75, 100, 0, 0, 1 };
// ACTUAL
int oreCost[TechTypes::Enum::MAX], gasCost[TechTypes::Enum::MAX], timeCost[TechTypes::Enum::MAX], energyCost[TechTypes::Enum::MAX];
namespace techInternalResearches
{
using namespace UnitTypes::Enum;
static const int whatResearches[TechTypes::Enum::MAX] =
{ Terran_Academy, Terran_Covert_Ops, Terran_Science_Facility, Terran_Machine_Shop,
None, Terran_Machine_Shop, None, Terran_Science_Facility, Terran_Physics_Lab,
Terran_Control_Tower, Terran_Covert_Ops, Zerg_Hatchery, None, Zerg_Queens_Nest,
None, Zerg_Defiler_Mound, Zerg_Defiler_Mound, Zerg_Queens_Nest, None,
Protoss_Templar_Archives, Protoss_Templar_Archives, Protoss_Arbiter_Tribunal,
Protoss_Arbiter_Tribunal, None, Terran_Academy, Protoss_Fleet_Beacon, None,
Protoss_Templar_Archives, None, None, Terran_Academy, Protoss_Templar_Archives,
Zerg_Hydralisk_Den, None, None, None, None, None, None, None, None, None, None, None,
None, None, Unknown
};
}
namespace techInternalRaces
{
using namespace Races::Enum;
static const int techRaces[TechTypes::Enum::MAX] =
{ Terran, Terran, Terran, Terran, Terran, Terran, Terran, Terran, Terran, Terran, Terran,
Zerg, Zerg, Zerg, Zerg, Zerg, Zerg, Zerg, Zerg,
Protoss, Protoss, Protoss, Protoss, Protoss,
Terran, Protoss, None, Protoss, Protoss, Protoss, Terran, Protoss, Zerg, None, Terran,
None, None, None, None, None, None, None, None, None, None, Terran, Unknown
};
}
namespace techInternalWeapons
{
using namespace WeaponTypes::Enum;
static const int techWeapons[TechTypes::Enum::MAX] =
{
None, Lockdown, EMP_Shockwave, Spider_Mines, None, None, None, Irradiate, Yamato_Gun,
None, None, None, None, Spawn_Broodlings, Dark_Swarm, Plague, Consume, Ensnare, Parasite,
Psionic_Storm, None, None, Stasis_Field, None, Restoration, Disruption_Web, None, Mind_Control,
None, Feedback, Optical_Flare, Maelstrom, None, None, None, None, None, None, None, None, None,
None, None, None, None, Nuclear_Strike, Unknown
};
}
#define TARG_UNIT 1
#define TARG_POS 2
#define TARG_BOTH 3
static const int techTypeFlags[TechTypes::Enum::MAX] =
{ 0, TARG_UNIT, TARG_BOTH, TARG_POS, TARG_BOTH, 0, TARG_UNIT, TARG_UNIT, TARG_UNIT, 0, 0, 0,
TARG_UNIT, TARG_UNIT, TARG_BOTH, TARG_BOTH, TARG_UNIT, TARG_BOTH, TARG_UNIT, TARG_BOTH, TARG_UNIT,
TARG_BOTH, TARG_BOTH, TARG_UNIT, TARG_UNIT, TARG_BOTH, 0, TARG_UNIT, TARG_UNIT, TARG_UNIT, TARG_UNIT,
TARG_BOTH, 0, 0, TARG_BOTH, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, TARG_BOTH };
namespace techInternalOrders
{
using namespace Orders::Enum;
static const int techOrders[TechTypes::Enum::MAX] =
{ None, CastLockdown, CastEMPShockwave, PlaceMine, CastScannerSweep, None, CastDefensiveMatrix,
CastIrradiate, FireYamatoGun, None, None, None, CastInfestation, CastSpawnBroodlings,
CastDarkSwarm, CastPlague, CastConsume, CastEnsnare, CastParasite, CastPsionicStorm,
CastHallucination, CastRecall, CastStasisField, None, CastRestoration, CastDisruptionWeb,
None, CastMindControl, None, CastFeedback, CastOpticalFlare, CastMaelstrom, None, None, MedicHeal,
None, None, None, None, None, None, None, None, None, None, NukePaint, Unknown
};
}
namespace techInternalUsage
{
using namespace UnitTypes::Enum;
static const UnitType::set techWhatUses[TechTypes::Enum::MAX] =
{
// Stimpacks
{ Terran_Marine, Terran_Firebat, Hero_Jim_Raynor_Marine, Hero_Gui_Montag },
// Lockdown
{ Terran_Ghost, Hero_Alexei_Stukov, Hero_Infested_Duran, Hero_Samir_Duran, Hero_Sarah_Kerrigan },
// EMP
{ Terran_Science_Vessel, Hero_Magellan },
// Spider Mine
{ Terran_Vulture, Hero_Jim_Raynor_Vulture },
// Scanner Sweep
{ Terran_Comsat_Station },
// Siege Mode
{ Terran_Siege_Tank_Tank_Mode, Terran_Siege_Tank_Siege_Mode, Hero_Edmund_Duke_Tank_Mode, Hero_Edmund_Duke_Siege_Mode },
// Defensive Matrix
{ Terran_Science_Vessel, Hero_Magellan },
// Irradiate
{ Terran_Science_Vessel, Hero_Magellan },
// Yamato Cannon
{ Terran_Battlecruiser, Hero_Gerard_DuGalle, Hero_Hyperion, Hero_Norad_II },
// Cloaking Field
{ Terran_Wraith, Hero_Tom_Kazansky },
// Personnel Cloaking
{ Terran_Ghost, Hero_Alexei_Stukov, Hero_Infested_Duran, Hero_Samir_Duran, Hero_Sarah_Kerrigan, Hero_Infested_Kerrigan },
// Burrow
{ Zerg_Zergling, Zerg_Hydralisk, Zerg_Drone, Zerg_Defiler, Zerg_Infested_Terran, Hero_Unclean_One, Hero_Hunter_Killer, Hero_Devouring_One, Zerg_Lurker },
// Infestation
{ Zerg_Queen, Hero_Matriarch },
// Spawn Broodlings
{ Zerg_Queen, Hero_Matriarch },
// Dark Swarm
{ Zerg_Defiler, Hero_Unclean_One },
// Plague
{ Zerg_Defiler, Hero_Unclean_One },
// Consume
{ Zerg_Defiler, Hero_Unclean_One, Hero_Infested_Kerrigan, Hero_Infested_Duran },
// Ensnare
{ Zerg_Queen, Hero_Matriarch, Hero_Infested_Kerrigan },
// Parasite
{ Zerg_Queen, Hero_Matriarch },
// Psi Storm
{ Protoss_High_Templar, Hero_Tassadar, Hero_Infested_Kerrigan },
// Hallucination
{ Protoss_High_Templar, Hero_Tassadar },
// Recall
{ Protoss_Arbiter, Hero_Danimoth },
// Stasis Field
{ Protoss_Arbiter, Hero_Danimoth },
// Archon Warp
{ Protoss_High_Templar },
// Restoration
{ Terran_Medic },
// Disruption Web
{ Protoss_Corsair, Hero_Raszagal },
// Unused
{},
// Mind Control
{ Protoss_Dark_Archon },
// Dark Archon Meld
{ Protoss_Dark_Templar },
// Feedback
{ Protoss_Dark_Archon },
// Optical Flare
{ Terran_Medic },
// Maelstrom
{ Protoss_Dark_Archon },
// Lurker Aspect
{ Zerg_Hydralisk },
// Unused
{},
// Healing
{ Terran_Medic },
// Unused
{}, {}, {}, {}, {}, {}, {}, {}, {}, {},
// Extra (Nuke)
{ Terran_Ghost },
{}
};
}
namespace TechTypeSet
{
using namespace TechTypes::Enum;
const TechType::set techTypeSet = { Stim_Packs, Lockdown, EMP_Shockwave, Spider_Mines,
Scanner_Sweep, Tank_Siege_Mode, Defensive_Matrix, Irradiate,
Yamato_Gun, Cloaking_Field, Personnel_Cloaking, Burrowing,
Infestation, Spawn_Broodlings, Dark_Swarm, Plague, Consume,
Ensnare, Parasite, Psionic_Storm, Hallucination, Recall,
Stasis_Field, Archon_Warp, Restoration, Disruption_Web,
Mind_Control, Dark_Archon_Meld, Feedback, Optical_Flare,
Maelstrom, Lurker_Aspect, Healing, None, Nuclear_Strike, Unknown };
}
Race TechType::getRace() const
{
return techInternalRaces::techRaces[this->getID()];
}
int TechType::mineralPrice() const
{
return defaultOreCost[this->getID()];
}
int TechType::gasPrice() const
{
// Gas price is exactly the same as mineral price
return mineralPrice();
}
int TechType::researchTime() const
{
return defaultTimeCost[this->getID()];
}
int TechType::energyCost() const
{
return defaultEnergyCost[this->getID()];
}
UnitType TechType::whatResearches() const
{
return techInternalResearches::whatResearches[this->getID()];
}
WeaponType TechType::getWeapon() const
{
return techInternalWeapons::techWeapons[this->getID()];
}
bool TechType::targetsUnit() const
{
return !!(techTypeFlags[this->getID()] & TARG_UNIT);
}
bool TechType::targetsPosition() const
{
return !!(techTypeFlags[this->getID()] & TARG_POS);
}
const UnitType::set& TechType::whatUses() const
{
return techInternalUsage::techWhatUses[this->getID()];
}
Order TechType::getOrder() const
{
return techInternalOrders::techOrders[this->getID()];
}
const TechType::set& TechTypes::allTechTypes()
{
return TechTypeSet::techTypeSet;
}
UnitType TechType::requiredUnit() const
{
if (*this == TechTypes::Lurker_Aspect)
return UnitTypes::Zerg_Lair;
return UnitTypes::None;
}
}
|
//===----- FunctionOrder.cpp - Utility for function ordering --------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#include "swift/SILAnalysis/FunctionOrder.h"
#include "swift/SIL/SILBasicBlock.h"
#include "swift/SIL/SILFunction.h"
#include "swift/SIL/SILInstruction.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/TinyPtrVector.h"
#include <algorithm>
using namespace swift;
/// Use Tarjan's strongly connected components (SCC) algorithm to find
/// the SCCs in the call graph.
void BottomUpFunctionOrder::DFS(SILFunction *Start) {
// Set the DFSNum for this node if we haven't already, and if we
// have, which indicates it's already been visited, return.
if (!DFSNum.insert(std::make_pair(Start, NextDFSNum)).second)
return;
assert(MinDFSNum.find(Start) == MinDFSNum.end() &&
"Function should not already have a minimum DFS number!");
MinDFSNum[Start] = NextDFSNum;
++NextDFSNum;
DFSStack.insert(Start);
// Visit all the instructions, looking for apply sites.
for (auto &B : *Start) {
for (auto &I : B) {
auto FAS = FullApplySite::isa(&I);
if (!FAS)
continue;
auto Callees = BCA->getCalleeList(FAS);
for (auto *CalleeFn : Callees) {
// If not yet visited, visit the callee.
if (DFSNum.find(CalleeFn) == DFSNum.end()) {
DFS(CalleeFn);
MinDFSNum[Start] = std::min(MinDFSNum[Start], MinDFSNum[CalleeFn]);
} else if (DFSStack.count(CalleeFn)) {
// If the callee is on the stack, it update our minimum DFS
// number based on it's DFS number.
MinDFSNum[Start] = std::min(MinDFSNum[Start], DFSNum[CalleeFn]);
}
}
}
}
// If our DFS number is the minimum found, we've found a
// (potentially singleton) SCC, so pop the nodes off the stack and
// push the new SCC on our stack of SCCs.
if (DFSNum[Start] == MinDFSNum[Start]) {
SCC CurrentSCC;
SILFunction *Popped;
do {
Popped = DFSStack.pop_back_val();
CurrentSCC.push_back(Popped);
} while (Popped != Start);
TheSCCs.push_back(CurrentSCC);
}
}
void BottomUpFunctionOrder::FindSCCs(SILModule &M) {
for (auto &F : M)
DFS(&F);
}
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "extensions/browser/event_router.h"
#include <string>
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "content/public/browser/notification_service.h"
#include "extensions/browser/event_listener_map.h"
#include "extensions/browser/extensions_test.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
namespace {
// A simple mock to keep track of listener additions and removals.
class MockEventRouterObserver : public EventRouter::Observer {
public:
MockEventRouterObserver()
: listener_added_count_(0),
listener_removed_count_(0) {}
virtual ~MockEventRouterObserver() {}
int listener_added_count() const { return listener_added_count_; }
int listener_removed_count() const { return listener_removed_count_; }
const std::string& last_event_name() const { return last_event_name_; }
void Reset() {
listener_added_count_ = 0;
listener_removed_count_ = 0;
last_event_name_.clear();
}
// EventRouter::Observer overrides:
void OnListenerAdded(const EventListenerInfo& details) override {
listener_added_count_++;
last_event_name_ = details.event_name;
}
void OnListenerRemoved(const EventListenerInfo& details) override {
listener_removed_count_++;
last_event_name_ = details.event_name;
}
private:
int listener_added_count_;
int listener_removed_count_;
std::string last_event_name_;
DISALLOW_COPY_AND_ASSIGN(MockEventRouterObserver);
};
typedef base::Callback<scoped_ptr<EventListener>(
const std::string&, // event_name
content::RenderProcessHost*, // process
base::DictionaryValue* // filter (takes ownership)
)> EventListenerConstructor;
scoped_ptr<EventListener> CreateEventListenerForExtension(
const std::string& extension_id,
const std::string& event_name,
content::RenderProcessHost* process,
base::DictionaryValue* filter) {
return EventListener::ForExtension(
event_name, extension_id, process, make_scoped_ptr(filter));
}
scoped_ptr<EventListener> CreateEventListenerForURL(
const GURL& listener_url,
const std::string& event_name,
content::RenderProcessHost* process,
base::DictionaryValue* filter) {
return EventListener::ForURL(
event_name, listener_url, process, make_scoped_ptr(filter));
}
} // namespace
class EventRouterTest : public ExtensionsTest {
public:
EventRouterTest()
: notification_service_(content::NotificationService::Create()) {}
protected:
// Tests adding and removing observers from EventRouter.
void RunEventRouterObserverTest(const EventListenerConstructor& constructor);
private:
scoped_ptr<content::NotificationService> notification_service_;
DISALLOW_COPY_AND_ASSIGN(EventRouterTest);
};
TEST_F(EventRouterTest, GetBaseEventName) {
// Normal event names are passed through unchanged.
EXPECT_EQ("foo.onBar", EventRouter::GetBaseEventName("foo.onBar"));
// Sub-events are converted to the part before the slash.
EXPECT_EQ("foo.onBar", EventRouter::GetBaseEventName("foo.onBar/123"));
}
// Tests adding and removing observers from EventRouter.
void EventRouterTest::RunEventRouterObserverTest(
const EventListenerConstructor& constructor) {
EventRouter router(NULL, NULL);
scoped_ptr<EventListener> listener =
constructor.Run("event_name", NULL, new base::DictionaryValue());
// Add/remove works without any observers.
router.OnListenerAdded(listener.get());
router.OnListenerRemoved(listener.get());
// Register observers that both match and don't match the event above.
MockEventRouterObserver matching_observer;
router.RegisterObserver(&matching_observer, "event_name");
MockEventRouterObserver non_matching_observer;
router.RegisterObserver(&non_matching_observer, "other");
// Adding a listener notifies the appropriate observers.
router.OnListenerAdded(listener.get());
EXPECT_EQ(1, matching_observer.listener_added_count());
EXPECT_EQ(0, non_matching_observer.listener_added_count());
// Removing a listener notifies the appropriate observers.
router.OnListenerRemoved(listener.get());
EXPECT_EQ(1, matching_observer.listener_removed_count());
EXPECT_EQ(0, non_matching_observer.listener_removed_count());
// Adding the listener again notifies again.
router.OnListenerAdded(listener.get());
EXPECT_EQ(2, matching_observer.listener_added_count());
EXPECT_EQ(0, non_matching_observer.listener_added_count());
// Removing the listener again notifies again.
router.OnListenerRemoved(listener.get());
EXPECT_EQ(2, matching_observer.listener_removed_count());
EXPECT_EQ(0, non_matching_observer.listener_removed_count());
// Adding a listener with a sub-event notifies the main observer with
// proper details.
matching_observer.Reset();
scoped_ptr<EventListener> sub_event_listener =
constructor.Run("event_name/1", NULL, new base::DictionaryValue());
router.OnListenerAdded(sub_event_listener.get());
EXPECT_EQ(1, matching_observer.listener_added_count());
EXPECT_EQ(0, matching_observer.listener_removed_count());
EXPECT_EQ("event_name/1", matching_observer.last_event_name());
// Ditto for removing the listener.
matching_observer.Reset();
router.OnListenerRemoved(sub_event_listener.get());
EXPECT_EQ(0, matching_observer.listener_added_count());
EXPECT_EQ(1, matching_observer.listener_removed_count());
EXPECT_EQ("event_name/1", matching_observer.last_event_name());
}
TEST_F(EventRouterTest, EventRouterObserverForExtensions) {
RunEventRouterObserverTest(
base::Bind(&CreateEventListenerForExtension, "extension_id"));
}
TEST_F(EventRouterTest, EventRouterObserverForURLs) {
RunEventRouterObserverTest(
base::Bind(&CreateEventListenerForURL, GURL("http://google.com/path")));
}
} // namespace extensions
|
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
#include "Pixel2DAnimBlueprintNodeOptionalPinManager.h"
#include "UObject/UnrealType.h"
#include "Kismet2/BlueprintEditorUtils.h"
#include "Pixel2DAnimNode_Base.h"
#include "Pixel2DAnimGraphSchema.h"
#include "Pixel2DAnimGraphNode_Base.h"
FPixel2DAnimBlueprintNodeOptionalPinManager::FPixel2DAnimBlueprintNodeOptionalPinManager(class UPixel2DAnimGraphNode_Base* Node, TArray<UEdGraphPin*>* InOldPins)
: BaseNode(Node)
, OldPins(InOldPins)
{
if (OldPins)
{
for (UEdGraphPin* Pin : *OldPins)
{
OldPinMap.Add(Pin->PinName, Pin);
}
}
}
void FPixel2DAnimBlueprintNodeOptionalPinManager::GetRecordDefaults(FProperty* TestProperty, FOptionalPinFromProperty& Record) const
{
const UPixel2DAnimGraphSchema* Schema = GetDefault<UPixel2DAnimGraphSchema>();
// Determine if this is a pose or array of poses
FArrayProperty* ArrayProp = CastField<FArrayProperty>(TestProperty);
FStructProperty* StructProp = CastField<FStructProperty>((ArrayProp != NULL) ? ArrayProp->Inner : TestProperty);
const bool bIsPoseInput = (StructProp != NULL) && (StructProp->Struct->IsChildOf(FPixel2DPoseLinkBase::StaticStruct()));
//@TODO: Error if they specified two or more of these flags
const bool bAlwaysShow = TestProperty->HasMetaData(Schema->NAME_AlwaysAsPin) || bIsPoseInput;
const bool bOptional_ShowByDefault = TestProperty->HasMetaData(Schema->NAME_PinShownByDefault);
const bool bOptional_HideByDefault = TestProperty->HasMetaData(Schema->NAME_PinHiddenByDefault);
const bool bNeverShow = TestProperty->HasMetaData(Schema->NAME_NeverAsPin);
const bool bPropertyIsCustomized = TestProperty->HasMetaData(Schema->NAME_CustomizeProperty);
Record.bCanToggleVisibility = bOptional_ShowByDefault || bOptional_HideByDefault;
Record.bShowPin = bAlwaysShow || bOptional_ShowByDefault;
Record.bPropertyIsCustomized = bPropertyIsCustomized;
}
void FPixel2DAnimBlueprintNodeOptionalPinManager::CustomizePinData(UEdGraphPin* Pin, FName SourcePropertyName, int32 ArrayIndex, FProperty* Property) const
{
if (BaseNode != nullptr)
{
BaseNode->CustomizePinData(Pin, SourcePropertyName, ArrayIndex);
}
}
void FPixel2DAnimBlueprintNodeOptionalPinManager::PostInitNewPin(UEdGraphPin* Pin, FOptionalPinFromProperty& Record, int32 ArrayIndex, FProperty* Property, uint8* PropertyAddress, uint8* DefaultPropertyAddress) const
{
check(PropertyAddress != nullptr);
check(Record.bShowPin);
const UPixel2DAnimGraphSchema* Schema = GetDefault<UPixel2DAnimGraphSchema>();
// In all cases set autogenerated default value from node defaults
if (DefaultPropertyAddress)
{
FString LiteralValue;
FBlueprintEditorUtils::PropertyValueToString_Direct(Property, DefaultPropertyAddress, LiteralValue);
Schema->SetPinAutogeneratedDefaultValue(Pin, LiteralValue);
}
else
{
Schema->SetPinAutogeneratedDefaultValueBasedOnType(Pin);
}
if (OldPins == nullptr)
{
// Initial construction of a visible pin; copy values from the struct
FString LiteralValue;
FBlueprintEditorUtils::PropertyValueToString_Direct(Property, PropertyAddress, LiteralValue);
Schema->SetPinDefaultValueAtConstruction(Pin, LiteralValue);
}
else if (Record.bCanToggleVisibility)
{
if (UEdGraphPin* OldPin = OldPinMap.FindRef(Pin->PinName))
{
// Was already visible, values will get copied over in pin reconstruction code
}
else
{
// Convert the struct property into DefaultValue/DefaultValueObject
FString LiteralValue;
FBlueprintEditorUtils::PropertyValueToString_Direct(Property, PropertyAddress, LiteralValue);
Schema->SetPinDefaultValueAtConstruction(Pin, LiteralValue);
}
// Clear the asset reference on the node if the pin exists
// In theory this is only needed for pins that are newly created but there are a lot of existing nodes that have dead asset references
FObjectProperty* ObjectProperty = CastField<FObjectProperty>(Property);
if (ObjectProperty)
{
ObjectProperty->SetObjectPropertyValue(PropertyAddress, nullptr);
}
}
}
void FPixel2DAnimBlueprintNodeOptionalPinManager::PostRemovedOldPin(FOptionalPinFromProperty& Record, int32 ArrayIndex, FProperty* Property, uint8* PropertyAddress, uint8* DefaultPropertyAddress) const
{
check(PropertyAddress != nullptr);
check(!Record.bShowPin);
if (Record.bCanToggleVisibility && (OldPins != nullptr))
{
const FName OldPinName = (ArrayIndex != INDEX_NONE) ? *FString::Printf(TEXT("%s_%d"), *(Record.PropertyName.ToString()), ArrayIndex) : Record.PropertyName;
// Pin was visible but it's now hidden
if (UEdGraphPin* OldPin = OldPinMap.FindRef(OldPinName))
{
// Convert DefaultValue/DefaultValueObject and push back into the struct
FBlueprintEditorUtils::PropertyValueFromString_Direct(Property, OldPin->GetDefaultAsString(), PropertyAddress);
}
}
}
void FPixel2DAnimBlueprintNodeOptionalPinManager::AllocateDefaultPins(UStruct* SourceStruct, uint8* StructBasePtr, uint8* DefaultsPtr)
{
RebuildPropertyList(BaseNode->ShowPinForProperties, SourceStruct);
CreateVisiblePins(BaseNode->ShowPinForProperties, SourceStruct, EGPD_Input, BaseNode, StructBasePtr, DefaultsPtr);
}
|
#pragma once
#include <Vega/Std.hpp>
#include <Vega/Core/Core.hpp>
#include <Vega/Core/SharedObject.hpp>
namespace Vega::Core::Loader {
class PluginLoader final {
public:
explicit PluginLoader(boost::filesystem::path root) : mRoot(root) {
VEGA_RUNTIME_ERROR(!boost::filesystem::is_directory(mRoot), "Invalid sketch path")
}
void Update() {
mSharedObjects.erase(
std::remove_if(std::begin(mSharedObjects), std::end(mSharedObjects), [](const SharedObject &obj) {
return !obj.Exists() || obj.HasChanged();
}), std::end(mSharedObjects));
}
private:
boost::filesystem::path mRoot;
std::vector<SharedObject> mSharedObjects;
};
}
|
// Copyright (c) 2019 The Bigbang developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "config.h"
#include <algorithm>
#include <boost/filesystem.hpp>
#include <exception>
#include <iostream>
#include <numeric>
#include "rpc/rpc_error.h"
#include "util.h"
using namespace xengine;
namespace po = boost::program_options;
namespace fs = boost::filesystem;
namespace bigbang
{
CConfig::CConfig()
: emMode(EModeType::ERROR), pImpl(nullptr) {}
CConfig::~CConfig()
{
if (pImpl)
{
delete pImpl;
}
}
bool CConfig::Load(int argc, char* argv[], const fs::path& pathDefault,
const std::string& strConfile)
{
if (argc <= 0)
{
return false;
}
// call parse cmd
std::vector<std::string> vecCmd = xengine::CConfig::ParseCmd(argc, argv);
// determine mode type
std::string exec = fs::path(argv[0]).filename().string();
std::string cmd = (vecCmd.size() > 0) ? vecCmd[0] : "";
int ignoreCmd = 0;
if (exec == "bigbang-server")
{
emMode = EModeType::SERVER;
}
else if (exec == "bigbang-miner" || cmd == "miner")
{
emMode = EModeType::MINER;
}
else if (exec == "bigbang-cli")
{
emMode = EModeType::CONSOLE;
if (vecCmd.size() > 0)
{
subCmd = vecCmd[0];
}
}
else
{
if (cmd == "server" || cmd == "")
{
emMode = EModeType::SERVER;
if (cmd == "server")
{
ignoreCmd = 1;
}
}
else if (cmd == "miner")
{
emMode = EModeType::MINER;
ignoreCmd = 1;
}
else
{
emMode = EModeType::CONSOLE;
if (cmd == "console")
{
ignoreCmd = 1;
}
if (vecCmd.size() > ignoreCmd)
{
subCmd = vecCmd[ignoreCmd];
}
}
}
if (emMode == EModeType::ERROR)
{
return false;
}
pImpl = CMode::CreateConfig(emMode, subCmd);
pImpl->SetIgnoreCmd(ignoreCmd);
// Load
return pImpl->Load(argc, argv, pathDefault, strConfile);
}
bool CConfig::PostLoad()
{
if (pImpl)
{
try
{
return pImpl->PostLoad();
}
catch (rpc::CRPCException& e)
{
StdError(__PRETTY_FUNCTION__, (e.strMessage + rpc::strHelpTips).c_str());
return false;
}
catch (std::exception& e)
{
StdError(__PRETTY_FUNCTION__, e.what());
return false;
}
}
return false;
}
void CConfig::ListConfig() const
{
if (pImpl)
{
std::cout << pImpl->ListConfig() << std::endl;
}
}
std::string CConfig::Help() const
{
if (pImpl)
{
return CMode::Help(emMode, subCmd, pImpl->Help());
}
else
{
return CMode::Help(emMode, subCmd);
}
}
} // namespace bigbang
|
// Distributed under the BSD 2-Clause License - Copyright 2012-2021 Robin Degen
#include <aeon/rdp/parser.h>
#include <aeon/rdp/matchers.h>
#include <aeon/common/bom.h>
#include <gtest/gtest.h>
using namespace aeon;
TEST(test_rdp, test_advance_reverse_eof_bof_current)
{
rdp::parser parser{"123"};
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
EXPECT_FALSE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
EXPECT_EQ('1', rdp::current(parser));
EXPECT_TRUE(parser.advance());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ('2', rdp::current(parser));
EXPECT_TRUE(parser.advance());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ('3', rdp::current(parser));
EXPECT_TRUE(parser.advance());
EXPECT_TRUE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_FALSE(parser.advance());
EXPECT_TRUE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ('3', rdp::current(parser));
EXPECT_TRUE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ('2', rdp::current(parser));
EXPECT_TRUE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
EXPECT_EQ('1', rdp::current(parser));
EXPECT_FALSE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
}
TEST(test_rdp, test_advance_reverse_eof_bof_current_u8)
{
rdp::parser parser{u8"123"};
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
EXPECT_FALSE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
EXPECT_EQ('1', rdp::current(parser));
EXPECT_TRUE(parser.advance());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ('2', rdp::current(parser));
EXPECT_TRUE(parser.advance());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ('3', rdp::current(parser));
EXPECT_TRUE(parser.advance());
EXPECT_TRUE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_FALSE(parser.advance());
EXPECT_TRUE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ('3', rdp::current(parser));
EXPECT_TRUE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ('2', rdp::current(parser));
EXPECT_TRUE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
EXPECT_EQ('1', rdp::current(parser));
EXPECT_FALSE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
}
TEST(test_rdp, test_advance_reverse_eof_bof_current_wchar)
{
rdp::parser parser{L"123"};
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
EXPECT_FALSE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
EXPECT_EQ('1', rdp::current(parser));
EXPECT_TRUE(parser.advance());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ('2', rdp::current(parser));
EXPECT_TRUE(parser.advance());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ('3', rdp::current(parser));
EXPECT_TRUE(parser.advance());
EXPECT_TRUE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_FALSE(parser.advance());
EXPECT_TRUE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ('3', rdp::current(parser));
EXPECT_TRUE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ('2', rdp::current(parser));
EXPECT_TRUE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
EXPECT_EQ('1', rdp::current(parser));
EXPECT_FALSE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
}
TEST(test_rdp, test_advance_reverse_eof_bof_current_u32)
{
rdp::parser parser{U"123"};
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
EXPECT_FALSE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
EXPECT_EQ(U'1', rdp::current(parser));
EXPECT_TRUE(parser.advance());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ(U'2', rdp::current(parser));
EXPECT_TRUE(parser.advance());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ(U'3', rdp::current(parser));
EXPECT_TRUE(parser.advance());
EXPECT_TRUE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_FALSE(parser.advance());
EXPECT_TRUE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ(U'3', rdp::current(parser));
EXPECT_TRUE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_FALSE(rdp::bof(parser));
EXPECT_EQ(U'2', rdp::current(parser));
EXPECT_TRUE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
EXPECT_EQ(U'1', rdp::current(parser));
EXPECT_FALSE(parser.reverse());
EXPECT_FALSE(rdp::eof(parser));
EXPECT_TRUE(rdp::bof(parser));
}
TEST(test_rdp, test_offset_check_char)
{
rdp::parser parser{"123"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.check('1'));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_FALSE(parser.check('1'));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_TRUE(parser.check('2'));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_FALSE(parser.check('2'));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_TRUE(parser.check('3'));
EXPECT_EQ(3u, rdp::offset(parser));
EXPECT_FALSE(parser.check('3'));
EXPECT_EQ(3u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_check_char_u8)
{
rdp::parser parser{u8"123"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.check('1'));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_FALSE(parser.check('1'));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_TRUE(parser.check('2'));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_FALSE(parser.check('2'));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_TRUE(parser.check('3'));
EXPECT_EQ(3u, rdp::offset(parser));
EXPECT_FALSE(parser.check('3'));
EXPECT_EQ(3u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_check_char_wchar)
{
rdp::parser parser{L"123"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.check('1'));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_FALSE(parser.check('1'));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_TRUE(parser.check('2'));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_FALSE(parser.check('2'));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_TRUE(parser.check('3'));
EXPECT_EQ(3u, rdp::offset(parser));
EXPECT_FALSE(parser.check('3'));
EXPECT_EQ(3u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_check_char_u32)
{
rdp::parser parser{U"123"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.check(U'1'));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_FALSE(parser.check(U'1'));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_TRUE(parser.check(U'2'));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_FALSE(parser.check(U'2'));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_TRUE(parser.check(U'3'));
EXPECT_EQ(3u, rdp::offset(parser));
EXPECT_FALSE(parser.check(U'3'));
EXPECT_EQ(3u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_check_string)
{
rdp::parser parser{"123"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_FALSE(parser.check("13"));
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.check("12"));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_FALSE(parser.check("34"));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_TRUE(parser.check("3"));
EXPECT_EQ(3u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_check_string_u8)
{
rdp::parser parser{u8"123"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_FALSE(parser.check(u8"13"));
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.check(u8"12"));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_FALSE(parser.check(u8"34"));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_TRUE(parser.check(u8"3"));
EXPECT_EQ(3u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_check_wchar)
{
rdp::parser parser{L"123"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_FALSE(parser.check(L"13"));
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.check(L"12"));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_FALSE(parser.check(L"34"));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_TRUE(parser.check(L"3"));
EXPECT_EQ(3u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_check_string_u32)
{
rdp::parser parser{U"123"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_FALSE(parser.check(U"13"));
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.check(U"12"));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_FALSE(parser.check(U"34"));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_TRUE(parser.check(U"3"));
EXPECT_EQ(3u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_check_multiple)
{
rdp::parser parser{"123"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.check({'1', '|'}));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_FALSE(parser.check({'|', '1'}));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_TRUE(parser.check({'2', '5'}));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_FALSE(parser.check({'5', '2'}));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_TRUE(parser.check({'3', '4'}));
EXPECT_EQ(3u, rdp::offset(parser));
EXPECT_FALSE(parser.check({'4', '3'}));
EXPECT_EQ(3u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_check_multiple_u8)
{
rdp::parser parser{u8"123"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.check({'1', '|'}));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_FALSE(parser.check({'|', '1'}));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_TRUE(parser.check({'2', '5'}));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_FALSE(parser.check({'5', '2'}));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_TRUE(parser.check({'3', '4'}));
EXPECT_EQ(3u, rdp::offset(parser));
EXPECT_FALSE(parser.check({'4', '3'}));
EXPECT_EQ(3u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_check_multiple_wchar)
{
rdp::parser parser{L"123"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.check({'1', '|'}));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_FALSE(parser.check({'|', '1'}));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_TRUE(parser.check({'2', '5'}));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_FALSE(parser.check({'5', '2'}));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_TRUE(parser.check({'3', '4'}));
EXPECT_EQ(3u, rdp::offset(parser));
EXPECT_FALSE(parser.check({'4', '3'}));
EXPECT_EQ(3u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_check_multiple_u32)
{
rdp::parser parser{U"123"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.check({U'1', U'|'}));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_FALSE(parser.check({U'|', U'1'}));
EXPECT_EQ(1u, rdp::offset(parser));
EXPECT_TRUE(parser.check({U'2', U'5'}));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_FALSE(parser.check({U'5', U'2'}));
EXPECT_EQ(2u, rdp::offset(parser));
EXPECT_TRUE(parser.check({U'3', U'4'}));
EXPECT_EQ(3u, rdp::offset(parser));
EXPECT_FALSE(parser.check({U'4', U'3'}));
EXPECT_EQ(3u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip)
{
rdp::parser parser{"111122223333"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip('2');
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip('1');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip('1');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip('2');
EXPECT_EQ(8u, rdp::offset(parser));
parser.skip('3');
EXPECT_EQ(12u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip_u8)
{
rdp::parser parser{u8"111122223333"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip('2');
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip('1');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip('1');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip('2');
EXPECT_EQ(8u, rdp::offset(parser));
parser.skip('3');
EXPECT_EQ(12u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip_wchar)
{
rdp::parser parser{L"111122223333"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip('2');
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip('1');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip('1');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip('2');
EXPECT_EQ(8u, rdp::offset(parser));
parser.skip('3');
EXPECT_EQ(12u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip_u32)
{
rdp::parser parser{U"111122223333"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip(U'2');
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip(U'1');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip(U'1');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip(U'2');
EXPECT_EQ(8u, rdp::offset(parser));
parser.skip(U'3');
EXPECT_EQ(12u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip_multiple)
{
rdp::parser parser{"11112222333344444555556666677777"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip({'2', '3'});
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip({'1', '2'});
EXPECT_EQ(8u, rdp::offset(parser));
parser.skip({'1', '2'});
EXPECT_EQ(8u, rdp::offset(parser));
parser.skip({'3', '4', '5', '7'});
EXPECT_EQ(22u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip_multiple_u8)
{
rdp::parser parser{u8"11112222333344444555556666677777"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip({'2', '3'});
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip({'1', '2'});
EXPECT_EQ(8u, rdp::offset(parser));
parser.skip({'1', '2'});
EXPECT_EQ(8u, rdp::offset(parser));
parser.skip({'3', '4', '5', '7'});
EXPECT_EQ(22u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip_multiple_wchar)
{
rdp::parser parser{L"11112222333344444555556666677777"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip({'2', '3'});
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip({'1', '2'});
EXPECT_EQ(8u, rdp::offset(parser));
parser.skip({'1', '2'});
EXPECT_EQ(8u, rdp::offset(parser));
parser.skip({'3', '4', '5', '7'});
EXPECT_EQ(22u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip_multiple_u32)
{
rdp::parser parser{U"11112222333344444555556666677777"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip({U'2', U'3'});
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip({U'1', U'2'});
EXPECT_EQ(8u, rdp::offset(parser));
parser.skip({U'1', U'2'});
EXPECT_EQ(8u, rdp::offset(parser));
parser.skip({U'3', U'4', U'5', U'7'});
EXPECT_EQ(22u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip_until)
{
rdp::parser parser{"111122223333"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until('1');
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until('2');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip_until('2');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip_until('3');
EXPECT_EQ(8u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip_until_u8)
{
rdp::parser parser{u8"111122223333"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until('1');
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until('2');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip_until('2');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip_until('3');
EXPECT_EQ(8u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip_until_wchar)
{
rdp::parser parser{L"111122223333"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until('1');
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until('2');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip_until('2');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip_until('3');
EXPECT_EQ(8u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip_until_u32)
{
rdp::parser parser{U"111122223333"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until(U'1');
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until(U'2');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip_until(U'2');
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip_until(U'3');
EXPECT_EQ(8u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip_until_multiple)
{
rdp::parser parser{"11112222333344444555556666677777"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until({'1'});
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until({'2', '3'});
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip_until({'5', '6'});
EXPECT_EQ(17u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip_until_multiple_u8)
{
rdp::parser parser{u8"11112222333344444555556666677777"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until({'1'});
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until({'2', '3'});
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip_until({'5', '6'});
EXPECT_EQ(17u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip_until_multiple_wchar)
{
rdp::parser parser{L"11112222333344444555556666677777"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until({'1'});
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until({'2', '3'});
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip_until({'5', '6'});
EXPECT_EQ(17u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_skip_until_multiple_u32)
{
rdp::parser parser{U"11112222333344444555556666677777"};
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until({U'1'});
EXPECT_EQ(0u, rdp::offset(parser));
parser.skip_until({U'2', U'3'});
EXPECT_EQ(4u, rdp::offset(parser));
parser.skip_until({U'5', U'6'});
EXPECT_EQ(17u, rdp::offset(parser));
}
TEST(test_rdp, test_offset_match_until)
{
rdp::parser parser{"111122223333"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_EQ("1111", parser.match_until('2').value());
EXPECT_EQ(8u, parser.remaining_size());
EXPECT_EQ("2222", parser.match_until('3').value());
EXPECT_EQ(4u, parser.remaining_size());
EXPECT_TRUE(parser.match_until('4').is_unmatched());
}
TEST(test_rdp, test_offset_match_until_u8)
{
rdp::parser parser{u8"111122223333"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_EQ(u8"1111", parser.match_until('2').value());
EXPECT_EQ(8u, parser.remaining_size());
EXPECT_EQ(u8"2222", parser.match_until('3').value());
EXPECT_EQ(4u, parser.remaining_size());
EXPECT_TRUE(parser.match_until('4').is_unmatched());
}
TEST(test_rdp, test_offset_match_until_wchar)
{
rdp::parser parser{L"111122223333"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_EQ(L"1111", parser.match_until('2').value());
EXPECT_EQ(8u, parser.remaining_size());
EXPECT_EQ(L"2222", parser.match_until('3').value());
EXPECT_EQ(4u, parser.remaining_size());
EXPECT_TRUE(parser.match_until('4').is_unmatched());
}
TEST(test_rdp, test_offset_match_until_u32)
{
rdp::parser parser{U"111122223333"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_EQ(U"1111", parser.match_until(U'2').value());
EXPECT_EQ(8u, parser.remaining_size());
EXPECT_EQ(U"2222", parser.match_until(U'3').value());
EXPECT_EQ(4u, parser.remaining_size());
EXPECT_TRUE(parser.match_until(U'4').is_unmatched());
}
TEST(test_rdp, test_offset_match_until_with_eof)
{
rdp::parser parser{"112233"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match_until('4', rdp::eof_mode::fail).is_unmatched());
EXPECT_EQ("112233", parser.match_until('4', rdp::eof_mode::match).value());
}
TEST(test_rdp, test_offset_match_until_with_eof_u8)
{
rdp::parser parser{u8"112233"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match_until('4', rdp::eof_mode::fail).is_unmatched());
EXPECT_EQ(u8"112233", parser.match_until('4', rdp::eof_mode::match).value());
}
TEST(test_rdp, test_offset_match_until_with_eof_wchar)
{
rdp::parser parser{L"112233"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match_until('4', rdp::eof_mode::fail).is_unmatched());
EXPECT_EQ(L"112233", parser.match_until('4', rdp::eof_mode::match).value());
}
TEST(test_rdp, test_offset_match_until_with_eof_u32)
{
rdp::parser parser{U"112233"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match_until(U'4', rdp::eof_mode::fail).is_unmatched());
EXPECT_EQ(U"112233", parser.match_until(U'4', rdp::eof_mode::match).value());
}
TEST(test_rdp, test_offset_match_until_multiple)
{
rdp::parser parser{"11112,222|3333"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_EQ("1111", parser.match_until({'2', ','}).value());
EXPECT_EQ(10u, parser.remaining_size());
EXPECT_EQ("2", parser.match_until({'2', ','}).value());
EXPECT_EQ(9u, parser.remaining_size());
EXPECT_EQ(",222", parser.match_until({'3', '|'}).value());
EXPECT_TRUE(parser.match_until('4').is_unmatched());
}
TEST(test_rdp, test_offset_match_until_multiple_u8)
{
rdp::parser parser{u8"11112,222|3333"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_EQ(u8"1111", parser.match_until({'2', ','}).value());
EXPECT_EQ(10u, parser.remaining_size());
EXPECT_EQ(u8"2", parser.match_until({'2', ','}).value());
EXPECT_EQ(9u, parser.remaining_size());
EXPECT_EQ(u8",222", parser.match_until({'3', '|'}).value());
EXPECT_TRUE(parser.match_until('4').is_unmatched());
}
TEST(test_rdp, test_offset_match_until_multiple_wchar)
{
rdp::parser parser{L"11112,222|3333"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_EQ(L"1111", parser.match_until({'2', ','}).value());
EXPECT_EQ(10u, parser.remaining_size());
EXPECT_EQ(L"2", parser.match_until({'2', ','}).value());
EXPECT_EQ(9u, parser.remaining_size());
EXPECT_EQ(L",222", parser.match_until({'3', '|'}).value());
EXPECT_TRUE(parser.match_until('4').is_unmatched());
}
TEST(test_rdp, test_offset_match_until_multiple_u32)
{
rdp::parser parser{U"11112,222|3333"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_EQ(U"1111", parser.match_until({U'2', U','}).value());
EXPECT_EQ(10u, parser.remaining_size());
EXPECT_EQ(U"2", parser.match_until({U'2', U','}).value());
EXPECT_EQ(9u, parser.remaining_size());
EXPECT_EQ(U",222", parser.match_until({U'3', U'|'}).value());
EXPECT_TRUE(parser.match_until(U'4').is_unmatched());
}
TEST(test_rdp, test_offset_match_until_multiple_with_eof)
{
rdp::parser parser{"11|22,33"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match_until({'4', '$'}, rdp::eof_mode::fail).is_unmatched());
EXPECT_EQ("11|22,33", parser.match_until({'$', '4'}, rdp::eof_mode::match).value());
}
TEST(test_rdp, test_offset_match_until_multiple_with_eof_u8)
{
rdp::parser parser{u8"11|22,33"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match_until({'4', '$'}, rdp::eof_mode::fail).is_unmatched());
EXPECT_EQ(u8"11|22,33", parser.match_until({'$', '4'}, rdp::eof_mode::match).value());
}
TEST(test_rdp, test_offset_match_until_multiple_with_eof_wchar)
{
rdp::parser parser{L"11|22,33"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match_until({'4', '$'}, rdp::eof_mode::fail).is_unmatched());
EXPECT_EQ(L"11|22,33", parser.match_until({'$', '4'}, rdp::eof_mode::match).value());
}
TEST(test_rdp, test_offset_match_until_multiple_with_eof_u32)
{
rdp::parser parser{U"11|22,33"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match_until({U'4', U'$'}, rdp::eof_mode::fail).is_unmatched());
EXPECT_EQ(U"11|22,33", parser.match_until({U'$', U'4'}, rdp::eof_mode::match).value());
}
TEST(test_rdp, test_offset_match_until_string)
{
rdp::parser parser{"112233abc123"};
EXPECT_EQ("112233", parser.match_until("abc").value());
EXPECT_EQ(6u, parser.remaining_size());
EXPECT_EQ("abc1", parser.match_until("23").value());
EXPECT_EQ(2u, parser.remaining_size());
}
TEST(test_rdp, test_offset_match_until_string_u8)
{
rdp::parser parser{u8"112233abc123"};
EXPECT_EQ(u8"112233", parser.match_until(u8"abc").value());
EXPECT_EQ(6u, parser.remaining_size());
EXPECT_EQ(u8"abc1", parser.match_until(u8"23").value());
EXPECT_EQ(2u, parser.remaining_size());
}
TEST(test_rdp, test_offset_match_until_string_wchar)
{
rdp::parser parser{L"112233abc123"};
EXPECT_EQ(L"112233", parser.match_until(L"abc").value());
EXPECT_EQ(6u, parser.remaining_size());
EXPECT_EQ(L"abc1", parser.match_until(L"23").value());
EXPECT_EQ(2u, parser.remaining_size());
}
TEST(test_rdp, test_offset_match_until_string_u32)
{
rdp::parser parser{U"112233abc123"};
EXPECT_EQ(U"112233", parser.match_until(U"abc").value());
EXPECT_EQ(6u, parser.remaining_size());
EXPECT_EQ(U"abc1", parser.match_until(U"23").value());
EXPECT_EQ(2u, parser.remaining_size());
}
TEST(test_rdp, test_offset_match_until_string_real_utf8)
{
rdp::parser parser{u8"らき☆すた, Raki☆Suta"};
// Unfortunately, these can not be put inside of an EXPECT_* since the macro is not
// able to print the utf8 characters when it fails. This triggers a compiler warning.
const bool result1 = (std::u8string_view{u8"らき"} == parser.match_until(u8"☆").value());
EXPECT_TRUE(result1);
const bool result2 = (std::u8string_view{u8"☆すた"} == parser.match_until(u8",").value());
EXPECT_TRUE(result2);
const bool result3 = (std::u8string_view{u8", Raki☆"} == parser.match_until(u8"Suta").value());
EXPECT_TRUE(result3);
}
TEST(test_rdp, test_offset_match_each)
{
rdp::parser parser{"1213414adbdcacd55658758"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match_each({'2', '3', '4'}).is_unmatched());
EXPECT_EQ("1213414", parser.match_each({'1', '2', '3', '4'}).value());
EXPECT_EQ("adbdcacd", parser.match_each({'a', 'b', 'c', 'd'}).value());
EXPECT_TRUE(parser.match_each({'1', '2', '3', '4'}).is_unmatched());
EXPECT_EQ("55658758", parser.match_each({'5', '6', '7', '8'}).value());
}
TEST(test_rdp, test_offset_match_each_u8)
{
rdp::parser parser{u8"1213414adbdcacd55658758"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match_each({'2', '3', '4'}).is_unmatched());
EXPECT_EQ(u8"1213414", parser.match_each({'1', '2', '3', '4'}).value());
EXPECT_EQ(u8"adbdcacd", parser.match_each({'a', 'b', 'c', 'd'}).value());
EXPECT_TRUE(parser.match_each({'1', '2', '3', '4'}).is_unmatched());
EXPECT_EQ(u8"55658758", parser.match_each({'5', '6', '7', '8'}).value());
}
TEST(test_rdp, test_offset_match_each_wchar)
{
rdp::parser parser{L"1213414adbdcacd55658758"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match_each({'2', '3', '4'}).is_unmatched());
EXPECT_EQ(L"1213414", parser.match_each({'1', '2', '3', '4'}).value());
EXPECT_EQ(L"adbdcacd", parser.match_each({'a', 'b', 'c', 'd'}).value());
EXPECT_TRUE(parser.match_each({'1', '2', '3', '4'}).is_unmatched());
EXPECT_EQ(L"55658758", parser.match_each({'5', '6', '7', '8'}).value());
}
TEST(test_rdp, test_offset_match_each_u32)
{
rdp::parser parser{U"1213414adbdcacd55658758"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match_each({U'2', U'3', U'4'}).is_unmatched());
EXPECT_EQ(U"1213414", parser.match_each({U'1', U'2', U'3', U'4'}).value());
EXPECT_EQ(U"adbdcacd", parser.match_each({U'a', U'b', U'c', U'd'}).value());
EXPECT_TRUE(parser.match_each({U'1', U'2', U'3', U'4'}).is_unmatched());
EXPECT_EQ(U"55658758", parser.match_each({U'5', U'6', U'7', U'8'}).value());
}
TEST(test_rdp, test_offset_match_pred)
{
rdp::parser parser{"1234abcd5678"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match([](const auto c) { return std::isalpha(c) != 0; }).is_unmatched());
// TODO: A lambda cannot appear in an unevaluated context. Fix with C++20.
EXPECT_EQ("1234", parser.match([](const auto c) { return std::isdigit(c) != 0; }).value());
EXPECT_EQ("abcd", parser.match([](const auto c) { return std::isalpha(c) != 0; }).value());
EXPECT_TRUE(parser.match([](const auto c) { return std::isalpha(c) != 0; }).is_unmatched());
EXPECT_EQ("5678", parser.match([](const auto c) { return std::isdigit(c) != 0; }).value());
}
TEST(test_rdp, test_offset_match_pred_u8)
{
rdp::parser parser{u8"1234abcd5678"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match([](const auto c) { return std::isalpha(c) != 0; }).is_unmatched());
// TODO: A lambda cannot appear in an unevaluated context. Fix with C++20.
EXPECT_EQ(u8"1234", parser.match([](const auto c) { return std::isdigit(c) != 0; }).value());
EXPECT_EQ(u8"abcd", parser.match([](const auto c) { return std::isalpha(c) != 0; }).value());
EXPECT_TRUE(parser.match([](const auto c) { return std::isalpha(c) != 0; }).is_unmatched());
EXPECT_EQ(u8"5678", parser.match([](const auto c) { return std::isdigit(c) != 0; }).value());
}
TEST(test_rdp, test_offset_match_pred_wchar)
{
rdp::parser parser{L"1234abcd5678"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match([](const auto c) { return std::isalpha(c) != 0; }).is_unmatched());
// TODO: A lambda cannot appear in an unevaluated context. Fix with C++20.
EXPECT_EQ(L"1234", parser.match([](const auto c) { return std::isdigit(c) != 0; }).value());
EXPECT_EQ(L"abcd", parser.match([](const auto c) { return std::isalpha(c) != 0; }).value());
EXPECT_TRUE(parser.match([](const auto c) { return std::isalpha(c) != 0; }).is_unmatched());
EXPECT_EQ(L"5678", parser.match([](const auto c) { return std::isdigit(c) != 0; }).value());
}
TEST(test_rdp, test_offset_match_pred_u32)
{
rdp::parser parser{U"1234abcd5678"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser.match([](const auto c) { return std::isalpha(c) != 0; }).is_unmatched());
// TODO: A lambda cannot appear in an unevaluated context. Fix with C++20.
EXPECT_EQ(U"1234", parser.match([](const auto c) { return std::isdigit(c) != 0; }).value());
EXPECT_EQ(U"abcd", parser.match([](const auto c) { return std::isalpha(c) != 0; }).value());
EXPECT_TRUE(parser.match([](const auto c) { return std::isalpha(c) != 0; }).is_unmatched());
EXPECT_EQ(U"5678", parser.match([](const auto c) { return std::isdigit(c) != 0; }).value());
}
TEST(test_rdp, test_offset_match_pred_indexed)
{
rdp::parser parser{"1a2b3c4d"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser
.match_indexed(
[](const auto c, const auto i)
{
if (i % 2 == 0)
return std::isalpha(c) != 0;
return std::isdigit(c) != 0;
})
.is_unmatched());
EXPECT_EQ("1a2b3c4d", parser
.match_indexed(
[](const auto c, const auto i)
{
if (i % 2 == 0)
return std::isdigit(c) != 0;
return std::isalpha(c) != 0;
})
.value());
}
TEST(test_rdp, test_offset_match_pred_indexed_u8)
{
rdp::parser parser{u8"1a2b3c4d"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser
.match_indexed(
[](const auto c, const auto i)
{
if (i % 2 == 0)
return std::isalpha(c) != 0;
return std::isdigit(c) != 0;
})
.is_unmatched());
EXPECT_EQ(u8"1a2b3c4d", parser
.match_indexed(
[](const auto c, const auto i)
{
if (i % 2 == 0)
return std::isdigit(c) != 0;
return std::isalpha(c) != 0;
})
.value());
}
TEST(test_rdp, test_offset_match_pred_indexed_wchar)
{
rdp::parser parser{L"1a2b3c4d"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser
.match_indexed(
[](const auto c, const auto i)
{
if (i % 2 == 0)
return std::isalpha(c) != 0;
return std::isdigit(c) != 0;
})
.is_unmatched());
EXPECT_EQ(L"1a2b3c4d", parser
.match_indexed(
[](const auto c, const auto i)
{
if (i % 2 == 0)
return std::isdigit(c) != 0;
return std::isalpha(c) != 0;
})
.value());
}
TEST(test_rdp, test_offset_match_pred_indexed_u32)
{
rdp::parser parser{U"1a2b3c4d"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(parser
.match_indexed(
[](const auto c, const auto i)
{
if (i % 2 == 0)
return std::isalpha(c) != 0;
return std::isdigit(c) != 0;
})
.is_unmatched());
EXPECT_EQ(U"1a2b3c4d", parser
.match_indexed(
[](const auto c, const auto i)
{
if (i % 2 == 0)
return std::isdigit(c) != 0;
return std::isalpha(c) != 0;
})
.value());
}
TEST(test_rdp, test_offset_match_regex)
{
rdp::parser parser{"111122223333aaaabbbbcccc1234"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(match_regex(parser, "[a-zA-Z]+").is_unmatched());
EXPECT_EQ("111122223333", match_regex(parser, "[1-3]+").value());
EXPECT_TRUE(match_regex(parser, "[1-3]+").is_unmatched());
EXPECT_EQ("aaaabbbbcccc", match_regex(parser, "[a-zA-Z]+").value());
EXPECT_TRUE(match_regex(parser, "[a-zA-Z]+").is_unmatched());
EXPECT_EQ("123", match_regex(parser, "[1-3]+").value());
EXPECT_EQ("4", match_regex(parser, "[1-4]+").value());
EXPECT_TRUE(match_regex(parser, ".*").is_unmatched());
}
TEST(test_rdp, test_offset_match_regex_wchar)
{
rdp::parser parser{L"111122223333aaaabbbbcccc1234"};
EXPECT_EQ(0u, rdp::offset(parser));
EXPECT_TRUE(match_regex(parser, L"[a-zA-Z]+").is_unmatched());
EXPECT_EQ(L"111122223333", match_regex(parser, L"[1-3]+").value());
EXPECT_TRUE(match_regex(parser, L"[1-3]+").is_unmatched());
EXPECT_EQ(L"aaaabbbbcccc", match_regex(parser, L"[a-zA-Z]+").value());
EXPECT_TRUE(match_regex(parser, L"[a-zA-Z]+").is_unmatched());
EXPECT_EQ(L"123", match_regex(parser, L"[1-3]+").value());
EXPECT_EQ(L"4", match_regex(parser, L"[1-4]+").value());
EXPECT_TRUE(match_regex(parser, L".*").is_unmatched());
}
TEST(test_rdp, test_offset_match_regex_empty_sequence)
{
rdp::parser parser{"111122223333aaaabbbbcccc1234"};
EXPECT_TRUE(match_regex(parser, "[a-zA-Z]*").is_unmatched());
}
TEST(test_rdp, test_offset_match_regex_empty_sequence_wchar)
{
rdp::parser parser{L"111122223333aaaabbbbcccc1234"};
EXPECT_TRUE(match_regex(parser, L"[a-zA-Z]*").is_unmatched());
}
TEST(test_rdp, test_offset_match_advanced)
{
rdp::parser parser{"Validvariable123 somethingElse {}"};
rdp::parser parser2{"123Inalidvariable123 Hello {}"};
rdp::parser parser3{"__123Validvariable123 123 {}"};
EXPECT_EQ("Validvariable123", match_regex(parser, "[a-zA-Z_][a-zA-Z0-9\\-_]*").value());
EXPECT_TRUE(match_regex(parser2, "[a-zA-Z][a-zA-Z0-9\\-_]*").is_unmatched());
EXPECT_EQ("__123Validvariable123", match_regex(parser3, "[a-zA-Z_][a-zA-Z0-9\\-_]*").value());
}
TEST(test_rdp, test_offset_match_advanced_wchar)
{
rdp::parser parser{L"Validvariable123 somethingElse {}"};
rdp::parser parser2{L"123Inalidvariable123 Hello {}"};
rdp::parser parser3{L"__123Validvariable123 123 {}"};
EXPECT_EQ(L"Validvariable123", match_regex(parser, L"[a-zA-Z_][a-zA-Z0-9\\-_]*").value());
EXPECT_TRUE(match_regex(parser2, L"[a-zA-Z][a-zA-Z0-9\\-_]*").is_unmatched());
EXPECT_EQ(L"__123Validvariable123", match_regex(parser3, L"[a-zA-Z_][a-zA-Z0-9\\-_]*").value());
}
void check_parse_decimal_signed(const std::string_view str, const std::int64_t expected)
{
rdp::parser parser{str};
EXPECT_EQ(expected, rdp::parse_decimal_signed(parser));
}
TEST(test_rdp, test_parse_decimal_signed)
{
check_parse_decimal_signed("-12", -12);
check_parse_decimal_signed("12", 12);
check_parse_decimal_signed("-1234", -1234);
check_parse_decimal_signed("1234", 1234);
check_parse_decimal_signed("-123456", -123456);
check_parse_decimal_signed("123456", 123456);
check_parse_decimal_signed("-123456789", -123456789);
check_parse_decimal_signed("123456789", 123456789);
}
void check_parse_decimal_unsigned(const std::string_view str, const std::uint64_t expected)
{
rdp::parser parser{str};
EXPECT_EQ(expected, rdp::parse_decimal_unsigned(parser));
}
TEST(test_rdp, test_parse_decimal_unsigned)
{
check_parse_decimal_unsigned("12", 12);
check_parse_decimal_unsigned("1234", 1234);
check_parse_decimal_unsigned("123456", 123456);
check_parse_decimal_unsigned("123456789", 123456789);
}
void check_parse_binary(const std::string_view str, const std::uint64_t expected)
{
rdp::parser parser{str};
EXPECT_EQ(expected, rdp::parse_binary(parser));
}
TEST(test_rdp, test_parse_binary)
{
check_parse_binary("1010", 10);
check_parse_binary("1001001011010101", 37589);
check_parse_binary("10101001010001101001001011010101", 2839974613);
check_parse_binary("100010001001100010100100101010010101001010001101001001011010101", 4921399016379814613);
}
void check_parse_binary_prefixed(const std::string_view str, const std::uint64_t expected)
{
rdp::parser parser{str};
EXPECT_EQ(expected, rdp::parse_binary(parser, "0b"));
}
TEST(test_rdp, test_parse_binary_prefixed)
{
check_parse_binary_prefixed("0b1010", 10);
check_parse_binary_prefixed("0b1001001011010101", 37589);
check_parse_binary_prefixed("0b10101001010001101001001011010101", 2839974613);
check_parse_binary_prefixed("0b100010001001100010100100101010010101001010001101001001011010101",
4921399016379814613u);
}
void check_parse_hex(const std::string_view str, const std::uint64_t expected)
{
rdp::parser parser{str};
EXPECT_EQ(expected, rdp::parse_hexadecimal(parser));
}
TEST(test_rdp, test_parse_hexadecimal)
{
check_parse_hex("BD", 189);
check_parse_hex("BD74", 48500);
check_parse_hex("F1DA85FC", 4057630204);
check_parse_hex("57DB41EA587DB4FC", 6330726175962150140u);
}
void check_parse_hex_prefixed(const std::string_view str, const std::uint64_t expected)
{
rdp::parser parser{str};
EXPECT_EQ(expected, rdp::parse_hexadecimal(parser, "0x"));
}
TEST(test_rdp, test_parse_hexadecimal_prefixed)
{
check_parse_hex_prefixed("0xBD", 189);
check_parse_hex_prefixed("0xBD74", 48500);
check_parse_hex_prefixed("0xF1DA85FC", 4057630204);
check_parse_hex_prefixed("0x57DB41EA587DB4FC", 6330726175962150140u);
}
void check_skip_byte_order_marker(const std::string_view str, const std::string_view expected)
{
rdp::parser parser{str};
rdp::skip_byte_order_marker(parser);
EXPECT_TRUE(parser.check(expected));
}
TEST(test_rdp, test_skip_byte_order_marker)
{
check_skip_byte_order_marker("Hello", "Hello");
check_skip_byte_order_marker(common::bom::utf8::string() + "Hello", "Hello");
}
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/webui/url_data_manager_backend.h"
#include <set>
#include "base/bind.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/debug/alias.h"
#include "base/lazy_instance.h"
#include "base/location.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/weak_ptr.h"
#include "base/profiler/scoped_tracker.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/trace_event/trace_event.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/browser/histogram_internals_request_job.h"
#include "content/browser/net/view_blob_internals_job_factory.h"
#include "content/browser/net/view_http_cache_job_factory.h"
#include "content/browser/resource_context_impl.h"
#include "content/browser/webui/shared_resources_data_source.h"
#include "content/browser/webui/url_data_source_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/resource_request_info.h"
#include "content/public/common/url_constants.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/log/net_log_util.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_job.h"
#include "net/url_request/url_request_job_factory.h"
#include "url/url_util.h"
namespace content {
namespace {
const char kChromeURLContentSecurityPolicyHeaderBase[] =
"Content-Security-Policy: script-src chrome://resources 'self'";
const char kChromeURLXFrameOptionsHeader[] = "X-Frame-Options: DENY";
static const char kNetworkErrorKey[] = "netError";
const int kNoRenderProcessId = -1;
bool SchemeIsInSchemes(const std::string& scheme,
const std::vector<std::string>& schemes) {
return std::find(schemes.begin(), schemes.end(), scheme) != schemes.end();
}
// Returns whether |url| passes some sanity checks and is a valid GURL.
bool CheckURLIsValid(const GURL& url) {
std::vector<std::string> additional_schemes;
DCHECK(url.SchemeIs(kChromeDevToolsScheme) || url.SchemeIs(kChromeUIScheme) ||
(GetContentClient()->browser()->GetAdditionalWebUISchemes(
&additional_schemes),
SchemeIsInSchemes(url.scheme(), additional_schemes)));
if (!url.is_valid()) {
NOTREACHED();
return false;
}
return true;
}
// Parse |url| to get the path which will be used to resolve the request. The
// path is the remaining portion after the scheme and hostname.
void URLToRequestPath(const GURL& url, std::string* path) {
const std::string& spec = url.possibly_invalid_spec();
const url::Parsed& parsed = url.parsed_for_possibly_invalid_spec();
// + 1 to skip the slash at the beginning of the path.
int offset = parsed.CountCharactersBefore(url::Parsed::PATH, false) + 1;
if (offset < static_cast<int>(spec.size()))
path->assign(spec.substr(offset));
}
// Returns a value of 'Origin:' header for the |request| if the header is set.
// Otherwise returns an empty string.
std::string GetOriginHeaderValue(const net::URLRequest* request) {
std::string result;
if (request->extra_request_headers().GetHeader(
net::HttpRequestHeaders::kOrigin, &result))
return result;
net::HttpRequestHeaders headers;
if (request->GetFullRequestHeaders(&headers))
headers.GetHeader(net::HttpRequestHeaders::kOrigin, &result);
return result;
}
} // namespace
// URLRequestChromeJob is a net::URLRequestJob that manages running
// chrome-internal resource requests asynchronously.
// It hands off URL requests to ChromeURLDataManager, which asynchronously
// calls back once the data is available.
class URLRequestChromeJob : public net::URLRequestJob {
public:
// |is_incognito| set when job is generated from an incognito profile.
URLRequestChromeJob(net::URLRequest* request,
net::NetworkDelegate* network_delegate,
URLDataManagerBackend* backend,
bool is_incognito);
// net::URLRequestJob implementation.
void Start() override;
void Kill() override;
int ReadRawData(net::IOBuffer* buf, int buf_size) override;
bool GetMimeType(std::string* mime_type) const override;
int GetResponseCode() const override;
void GetResponseInfo(net::HttpResponseInfo* info) override;
// Used to notify that the requested data's |mime_type| is ready.
void MimeTypeAvailable(const std::string& mime_type);
// Called by ChromeURLDataManager to notify us that the data blob is ready
// for us.
void DataAvailable(base::RefCountedMemory* bytes);
// Returns a weak pointer to the job.
base::WeakPtr<URLRequestChromeJob> AsWeakPtr();
void set_mime_type(const std::string& mime_type) {
mime_type_ = mime_type;
}
void set_allow_caching(bool allow_caching) {
allow_caching_ = allow_caching;
}
void set_add_content_security_policy(bool add_content_security_policy) {
add_content_security_policy_ = add_content_security_policy;
}
void set_content_security_policy_object_source(
const std::string& data) {
content_security_policy_object_source_ = data;
}
void set_content_security_policy_frame_source(
const std::string& data) {
content_security_policy_frame_source_ = data;
}
void set_deny_xframe_options(bool deny_xframe_options) {
deny_xframe_options_ = deny_xframe_options;
}
void set_send_content_type_header(bool send_content_type_header) {
send_content_type_header_ = send_content_type_header;
}
void set_access_control_allow_origin(const std::string& value) {
access_control_allow_origin_ = value;
}
// Returns true when job was generated from an incognito profile.
bool is_incognito() const {
return is_incognito_;
}
private:
~URLRequestChromeJob() override;
// Helper for Start(), to let us start asynchronously.
// (This pattern is shared by most net::URLRequestJob implementations.)
void StartAsync(bool allowed);
// Called on the UI thread to check if this request is allowed.
static void CheckStoragePartitionMatches(
int render_process_id,
const GURL& url,
const base::WeakPtr<URLRequestChromeJob>& job);
// Specific resources require unsafe-eval in the Content Security Policy.
bool RequiresUnsafeEval() const;
// Do the actual copy from data_ (the data we're serving) into |buf|.
// Separate from ReadRawData so we can handle async I/O. Returns the number of
// bytes read.
int CompleteRead(net::IOBuffer* buf, int buf_size);
// The actual data we're serving. NULL until it's been fetched.
scoped_refptr<base::RefCountedMemory> data_;
// The current offset into the data that we're handing off to our
// callers via the Read interfaces.
int data_offset_;
// For async reads, we keep around a pointer to the buffer that
// we're reading into.
scoped_refptr<net::IOBuffer> pending_buf_;
int pending_buf_size_;
std::string mime_type_;
// If true, set a header in the response to prevent it from being cached.
bool allow_caching_;
// If true, set the Content Security Policy (CSP) header.
bool add_content_security_policy_;
// These are used with the CSP.
std::string content_security_policy_object_source_;
std::string content_security_policy_frame_source_;
// If true, sets the "X-Frame-Options: DENY" header.
bool deny_xframe_options_;
// If true, sets the "Content-Type: <mime-type>" header.
bool send_content_type_header_;
// If not empty, "Access-Control-Allow-Origin:" is set to the value of this
// string.
std::string access_control_allow_origin_;
// True when job is generated from an incognito profile.
const bool is_incognito_;
// The backend is owned by net::URLRequestContext and always outlives us.
URLDataManagerBackend* backend_;
base::WeakPtrFactory<URLRequestChromeJob> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(URLRequestChromeJob);
};
URLRequestChromeJob::URLRequestChromeJob(net::URLRequest* request,
net::NetworkDelegate* network_delegate,
URLDataManagerBackend* backend,
bool is_incognito)
: net::URLRequestJob(request, network_delegate),
data_offset_(0),
pending_buf_size_(0),
allow_caching_(true),
add_content_security_policy_(true),
content_security_policy_object_source_("object-src 'none';"),
content_security_policy_frame_source_("frame-src 'none';"),
deny_xframe_options_(true),
send_content_type_header_(false),
is_incognito_(is_incognito),
backend_(backend),
weak_factory_(this) {
DCHECK(backend);
}
URLRequestChromeJob::~URLRequestChromeJob() {
CHECK(!backend_->HasPendingJob(this));
}
void URLRequestChromeJob::Start() {
int render_process_id, unused;
bool is_renderer_request = ResourceRequestInfo::GetRenderFrameForRequest(
request_, &render_process_id, &unused);
if (!is_renderer_request)
render_process_id = kNoRenderProcessId;
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
base::Bind(&URLRequestChromeJob::CheckStoragePartitionMatches,
render_process_id, request_->url(),
weak_factory_.GetWeakPtr()));
TRACE_EVENT_ASYNC_BEGIN1("browser", "DataManager:Request", this, "URL",
request_->url().possibly_invalid_spec());
}
void URLRequestChromeJob::Kill() {
weak_factory_.InvalidateWeakPtrs();
backend_->RemoveRequest(this);
URLRequestJob::Kill();
}
bool URLRequestChromeJob::GetMimeType(std::string* mime_type) const {
*mime_type = mime_type_;
return !mime_type_.empty();
}
int URLRequestChromeJob::GetResponseCode() const {
return net::HTTP_OK;
}
void URLRequestChromeJob::GetResponseInfo(net::HttpResponseInfo* info) {
DCHECK(!info->headers.get());
// Set the headers so that requests serviced by ChromeURLDataManager return a
// status code of 200. Without this they return a 0, which makes the status
// indistiguishable from other error types. Instant relies on getting a 200.
info->headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK");
// Determine the least-privileged content security policy header, if any,
// that is compatible with a given WebUI URL, and append it to the existing
// response headers.
if (add_content_security_policy_) {
std::string base = kChromeURLContentSecurityPolicyHeaderBase;
base.append(RequiresUnsafeEval() ? " 'unsafe-eval'; " : "; ");
base.append(content_security_policy_object_source_);
base.append(content_security_policy_frame_source_);
info->headers->AddHeader(base);
}
if (deny_xframe_options_)
info->headers->AddHeader(kChromeURLXFrameOptionsHeader);
if (!allow_caching_)
info->headers->AddHeader("Cache-Control: no-cache");
if (send_content_type_header_ && !mime_type_.empty()) {
std::string content_type =
base::StringPrintf("%s:%s", net::HttpRequestHeaders::kContentType,
mime_type_.c_str());
info->headers->AddHeader(content_type);
}
if (!access_control_allow_origin_.empty()) {
info->headers->AddHeader("Access-Control-Allow-Origin: " +
access_control_allow_origin_);
info->headers->AddHeader("Vary: Origin");
}
}
void URLRequestChromeJob::MimeTypeAvailable(const std::string& mime_type) {
set_mime_type(mime_type);
NotifyHeadersComplete();
}
void URLRequestChromeJob::DataAvailable(base::RefCountedMemory* bytes) {
TRACE_EVENT_ASYNC_END0("browser", "DataManager:Request", this);
if (bytes) {
data_ = bytes;
if (pending_buf_.get()) {
CHECK(pending_buf_->data());
int result = CompleteRead(pending_buf_.get(), pending_buf_size_);
pending_buf_ = NULL;
ReadRawDataComplete(result);
}
} else {
// The request failed.
ReadRawDataComplete(net::ERR_FAILED);
}
}
base::WeakPtr<URLRequestChromeJob> URLRequestChromeJob::AsWeakPtr() {
return weak_factory_.GetWeakPtr();
}
int URLRequestChromeJob::ReadRawData(net::IOBuffer* buf, int buf_size) {
if (!data_.get()) {
DCHECK(!pending_buf_.get());
CHECK(buf->data());
pending_buf_ = buf;
pending_buf_size_ = buf_size;
return net::ERR_IO_PENDING;
}
// Otherwise, the data is available.
return CompleteRead(buf, buf_size);
}
int URLRequestChromeJob::CompleteRead(net::IOBuffer* buf, int buf_size) {
int remaining = data_->size() - data_offset_;
if (buf_size > remaining)
buf_size = remaining;
if (buf_size > 0) {
// TODO(pkasting): Remove ScopedTracker below once crbug.com/455423 is
// fixed.
tracked_objects::ScopedTracker tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"455423 URLRequestChromeJob::CompleteRead memcpy"));
memcpy(buf->data(), data_->front() + data_offset_, buf_size);
data_offset_ += buf_size;
}
return buf_size;
}
void URLRequestChromeJob::CheckStoragePartitionMatches(
int render_process_id,
const GURL& url,
const base::WeakPtr<URLRequestChromeJob>& job) {
// The embedder could put some webui pages in separate storage partition.
// RenderProcessHostImpl::IsSuitableHost would guard against top level pages
// being in the same process. We do an extra check to guard against an
// exploited renderer pretending to add them as a subframe. We skip this check
// for resources.
bool allowed = false;
std::vector<std::string> hosts;
GetContentClient()->
browser()->GetAdditionalWebUIHostsToIgnoreParititionCheck(&hosts);
if (url.SchemeIs(kChromeUIScheme) &&
(url.SchemeIs(kChromeUIScheme) ||
std::find(hosts.begin(), hosts.end(), url.host()) != hosts.end())) {
allowed = true;
} else if (render_process_id == kNoRenderProcessId) {
// Request was not issued by renderer.
allowed = true;
} else {
RenderProcessHost* process = RenderProcessHost::FromID(render_process_id);
if (process) {
StoragePartition* partition = BrowserContext::GetStoragePartitionForSite(
process->GetBrowserContext(), url);
allowed = partition == process->GetStoragePartition();
}
}
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
base::Bind(&URLRequestChromeJob::StartAsync, job, allowed));
}
void URLRequestChromeJob::StartAsync(bool allowed) {
if (!request_)
return;
if (!allowed || !backend_->StartRequest(request_, this)) {
NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED,
net::ERR_INVALID_URL));
}
}
// TODO(tsepez,mfoltz): Refine this method when tests have been fixed to not use
// eval()/new Function(). http://crbug.com/525224
bool URLRequestChromeJob::RequiresUnsafeEval() const {
return true;
}
namespace {
// Gets mime type for data that is available from |source| by |path|.
// After that, notifies |job| that mime type is available. This method
// should be called on the UI thread, but notification is performed on
// the IO thread.
void GetMimeTypeOnUI(URLDataSourceImpl* source,
const std::string& path,
const base::WeakPtr<URLRequestChromeJob>& job) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
std::string mime_type = source->source()->GetMimeType(path);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&URLRequestChromeJob::MimeTypeAvailable, job, mime_type));
}
} // namespace
namespace {
bool IsValidNetworkErrorCode(int error_code) {
std::unique_ptr<base::DictionaryValue> error_codes = net::GetNetConstants();
const base::DictionaryValue* net_error_codes_dict = nullptr;
for (base::DictionaryValue::Iterator itr(*error_codes); !itr.IsAtEnd();
itr.Advance()) {
if (itr.key() == kNetworkErrorKey) {
itr.value().GetAsDictionary(&net_error_codes_dict);
break;
}
}
if (net_error_codes_dict != nullptr) {
for (base::DictionaryValue::Iterator itr(*net_error_codes_dict);
!itr.IsAtEnd(); itr.Advance()) {
int net_error_code;
itr.value().GetAsInteger(&net_error_code);
if (error_code == net_error_code)
return true;
}
}
return false;
}
class ChromeProtocolHandler
: public net::URLRequestJobFactory::ProtocolHandler {
public:
// |is_incognito| should be set for incognito profiles.
ChromeProtocolHandler(ResourceContext* resource_context,
bool is_incognito,
ChromeBlobStorageContext* blob_storage_context)
: resource_context_(resource_context),
is_incognito_(is_incognito),
blob_storage_context_(blob_storage_context) {}
~ChromeProtocolHandler() override {}
net::URLRequestJob* MaybeCreateJob(
net::URLRequest* request,
net::NetworkDelegate* network_delegate) const override {
DCHECK(request);
// Check for chrome://view-http-cache/*, which uses its own job type.
if (ViewHttpCacheJobFactory::IsSupportedURL(request->url()))
return ViewHttpCacheJobFactory::CreateJobForRequest(request,
network_delegate);
// Next check for chrome://blob-internals/, which uses its own job type.
if (ViewBlobInternalsJobFactory::IsSupportedURL(request->url())) {
return ViewBlobInternalsJobFactory::CreateJobForRequest(
request, network_delegate, blob_storage_context_->context());
}
// Next check for chrome://histograms/, which uses its own job type.
if (request->url().SchemeIs(kChromeUIScheme) &&
request->url().host() == kChromeUIHistogramHost) {
return new HistogramInternalsRequestJob(request, network_delegate);
}
// Check for chrome://network-error/, which uses its own job type.
if (request->url().SchemeIs(kChromeUIScheme) &&
request->url().host() == kChromeUINetworkErrorHost) {
// Get the error code passed in via the request URL path.
std::basic_string<char> error_code_string =
request->url().path().substr(1);
int error_code;
if (base::StringToInt(error_code_string, &error_code)) {
// Check for a valid error code.
if (IsValidNetworkErrorCode(error_code) &&
error_code != net::Error::ERR_IO_PENDING) {
return new net::URLRequestErrorJob(request, network_delegate,
error_code);
}
}
}
// Fall back to using a custom handler
return new URLRequestChromeJob(
request, network_delegate,
GetURLDataManagerForResourceContext(resource_context_), is_incognito_);
}
bool IsSafeRedirectTarget(const GURL& location) const override {
return false;
}
private:
// These members are owned by ProfileIOData, which owns this ProtocolHandler.
content::ResourceContext* const resource_context_;
// True when generated from an incognito profile.
const bool is_incognito_;
ChromeBlobStorageContext* blob_storage_context_;
DISALLOW_COPY_AND_ASSIGN(ChromeProtocolHandler);
};
} // namespace
URLDataManagerBackend::URLDataManagerBackend()
: next_request_id_(0) {
URLDataSource* shared_source = new SharedResourcesDataSource();
URLDataSourceImpl* source_impl =
new URLDataSourceImpl(shared_source->GetSource(), shared_source);
AddDataSource(source_impl);
}
URLDataManagerBackend::~URLDataManagerBackend() {
for (DataSourceMap::iterator i = data_sources_.begin();
i != data_sources_.end(); ++i) {
i->second->backend_ = NULL;
}
data_sources_.clear();
}
// static
std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>
URLDataManagerBackend::CreateProtocolHandler(
content::ResourceContext* resource_context,
bool is_incognito,
ChromeBlobStorageContext* blob_storage_context) {
DCHECK(resource_context);
return base::WrapUnique(new ChromeProtocolHandler(
resource_context, is_incognito, blob_storage_context));
}
void URLDataManagerBackend::AddDataSource(
URLDataSourceImpl* source) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DataSourceMap::iterator i = data_sources_.find(source->source_name());
if (i != data_sources_.end()) {
if (!source->source()->ShouldReplaceExistingSource())
return;
i->second->backend_ = NULL;
}
data_sources_[source->source_name()] = source;
source->backend_ = this;
}
bool URLDataManagerBackend::HasPendingJob(
URLRequestChromeJob* job) const {
for (PendingRequestMap::const_iterator i = pending_requests_.begin();
i != pending_requests_.end(); ++i) {
if (i->second == job)
return true;
}
return false;
}
bool URLDataManagerBackend::StartRequest(const net::URLRequest* request,
URLRequestChromeJob* job) {
if (!CheckURLIsValid(request->url()))
return false;
URLDataSourceImpl* source = GetDataSourceFromURL(request->url());
if (!source)
return false;
if (!source->source()->ShouldServiceRequest(request))
return false;
std::string path;
URLToRequestPath(request->url(), &path);
source->source()->WillServiceRequest(request, &path);
// Save this request so we know where to send the data.
RequestID request_id = next_request_id_++;
pending_requests_.insert(std::make_pair(request_id, job));
job->set_allow_caching(source->source()->AllowCaching());
job->set_add_content_security_policy(
source->source()->ShouldAddContentSecurityPolicy());
job->set_content_security_policy_object_source(
source->source()->GetContentSecurityPolicyObjectSrc());
job->set_content_security_policy_frame_source(
source->source()->GetContentSecurityPolicyFrameSrc());
job->set_deny_xframe_options(
source->source()->ShouldDenyXFrameOptions());
job->set_send_content_type_header(
source->source()->ShouldServeMimeTypeAsContentTypeHeader());
std::string origin = GetOriginHeaderValue(request);
if (!origin.empty()) {
std::string header =
source->source()->GetAccessControlAllowOriginForOrigin(origin);
DCHECK(header.empty() || header == origin || header == "*" ||
header == "null");
job->set_access_control_allow_origin(header);
}
// Look up additional request info to pass down.
int render_process_id = -1;
int render_frame_id = -1;
ResourceRequestInfo::GetRenderFrameForRequest(request,
&render_process_id,
&render_frame_id);
// Forward along the request to the data source.
base::MessageLoop* target_message_loop =
source->source()->MessageLoopForRequestPath(path);
if (!target_message_loop) {
job->MimeTypeAvailable(source->source()->GetMimeType(path));
// Eliminate potentially dangling pointer to avoid future use.
job = NULL;
// The DataSource is agnostic to which thread StartDataRequest is called
// on for this path. Call directly into it from this thread, the IO
// thread.
source->source()->StartDataRequest(
path, render_process_id, render_frame_id,
base::Bind(&URLDataSourceImpl::SendResponse, source, request_id));
} else {
// URLRequestChromeJob should receive mime type before data. This
// is guaranteed because request for mime type is placed in the
// message loop before request for data. And correspondingly their
// replies are put on the IO thread in the same order.
target_message_loop->task_runner()->PostTask(
FROM_HERE, base::Bind(&GetMimeTypeOnUI, base::RetainedRef(source), path,
job->AsWeakPtr()));
// The DataSource wants StartDataRequest to be called on a specific thread,
// usually the UI thread, for this path.
target_message_loop->task_runner()->PostTask(
FROM_HERE, base::Bind(&URLDataManagerBackend::CallStartRequest,
base::RetainedRef(source), path,
render_process_id, render_frame_id, request_id));
}
return true;
}
URLDataSourceImpl* URLDataManagerBackend::GetDataSourceFromURL(
const GURL& url) {
// The input usually looks like: chrome://source_name/extra_bits?foo
// so do a lookup using the host of the URL.
DataSourceMap::iterator i = data_sources_.find(url.host());
if (i != data_sources_.end())
return i->second.get();
// No match using the host of the URL, so do a lookup using the scheme for
// URLs on the form source_name://extra_bits/foo .
i = data_sources_.find(url.scheme() + "://");
if (i != data_sources_.end())
return i->second.get();
// No matches found, so give up.
return NULL;
}
void URLDataManagerBackend::CallStartRequest(
scoped_refptr<URLDataSourceImpl> source,
const std::string& path,
int render_process_id,
int render_frame_id,
int request_id) {
if (BrowserThread::CurrentlyOn(BrowserThread::UI) &&
render_process_id != -1 &&
!RenderProcessHost::FromID(render_process_id)) {
// Make the request fail if its initiating renderer is no longer valid.
// This can happen when the IO thread posts this task just before the
// renderer shuts down.
source->SendResponse(request_id, NULL);
return;
}
source->source()->StartDataRequest(
path,
render_process_id,
render_frame_id,
base::Bind(&URLDataSourceImpl::SendResponse, source, request_id));
}
void URLDataManagerBackend::RemoveRequest(URLRequestChromeJob* job) {
// Remove the request from our list of pending requests.
// If/when the source sends the data that was requested, the data will just
// be thrown away.
for (PendingRequestMap::iterator i = pending_requests_.begin();
i != pending_requests_.end(); ++i) {
if (i->second == job) {
pending_requests_.erase(i);
return;
}
}
}
void URLDataManagerBackend::DataAvailable(RequestID request_id,
base::RefCountedMemory* bytes) {
// Forward this data on to the pending net::URLRequest, if it exists.
PendingRequestMap::iterator i = pending_requests_.find(request_id);
if (i != pending_requests_.end()) {
URLRequestChromeJob* job = i->second;
pending_requests_.erase(i);
job->DataAvailable(bytes);
}
}
namespace {
class DevToolsJobFactory
: public net::URLRequestJobFactory::ProtocolHandler {
public:
// |is_incognito| should be set for incognito profiles.
DevToolsJobFactory(content::ResourceContext* resource_context,
bool is_incognito);
~DevToolsJobFactory() override;
net::URLRequestJob* MaybeCreateJob(
net::URLRequest* request,
net::NetworkDelegate* network_delegate) const override;
private:
// |resource_context_| and |network_delegate_| are owned by ProfileIOData,
// which owns this ProtocolHandler.
content::ResourceContext* const resource_context_;
// True when generated from an incognito profile.
const bool is_incognito_;
DISALLOW_COPY_AND_ASSIGN(DevToolsJobFactory);
};
DevToolsJobFactory::DevToolsJobFactory(
content::ResourceContext* resource_context,
bool is_incognito)
: resource_context_(resource_context),
is_incognito_(is_incognito) {
DCHECK(resource_context_);
}
DevToolsJobFactory::~DevToolsJobFactory() {}
net::URLRequestJob*
DevToolsJobFactory::MaybeCreateJob(
net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
return new URLRequestChromeJob(
request, network_delegate,
GetURLDataManagerForResourceContext(resource_context_), is_incognito_);
}
} // namespace
net::URLRequestJobFactory::ProtocolHandler*
CreateDevToolsProtocolHandler(content::ResourceContext* resource_context,
bool is_incognito) {
return new DevToolsJobFactory(resource_context, is_incognito);
}
} // namespace content
|
// Copyright (c) 2011 Bryce Lelbach
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#if !defined(HPX_3C373507_9301_4368_B718_39D25FDF06F4)
#define HPX_3C373507_9301_4368_B718_39D25FDF06F4
#include <hpx/hpx_fwd.hpp>
#include <hpx/runtime/actions/plain_action.hpp>
#include <hpx/runtime/actions/continuation.hpp>
#endif
|
/*
* Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <tencentcloud/tag/v20180813/model/DeleteTagResponse.h>
#include <tencentcloud/core/utils/rapidjson/document.h>
#include <tencentcloud/core/utils/rapidjson/writer.h>
#include <tencentcloud/core/utils/rapidjson/stringbuffer.h>
using TencentCloud::CoreInternalOutcome;
using namespace TencentCloud::Tag::V20180813::Model;
using namespace rapidjson;
using namespace std;
DeleteTagResponse::DeleteTagResponse()
{
}
CoreInternalOutcome DeleteTagResponse::Deserialize(const string &payload)
{
Document d;
d.Parse(payload.c_str());
if (d.HasParseError() || !d.IsObject())
{
return CoreInternalOutcome(Error("response not json format"));
}
if (!d.HasMember("Response") || !d["Response"].IsObject())
{
return CoreInternalOutcome(Error("response `Response` is null or not object"));
}
Value &rsp = d["Response"];
if (!rsp.HasMember("RequestId") || !rsp["RequestId"].IsString())
{
return CoreInternalOutcome(Error("response `Response.RequestId` is null or not string"));
}
string requestId(rsp["RequestId"].GetString());
SetRequestId(requestId);
if (rsp.HasMember("Error"))
{
if (!rsp["Error"].IsObject() ||
!rsp["Error"].HasMember("Code") || !rsp["Error"]["Code"].IsString() ||
!rsp["Error"].HasMember("Message") || !rsp["Error"]["Message"].IsString())
{
return CoreInternalOutcome(Error("response `Response.Error` format error").SetRequestId(requestId));
}
string errorCode(rsp["Error"]["Code"].GetString());
string errorMsg(rsp["Error"]["Message"].GetString());
return CoreInternalOutcome(Error(errorCode, errorMsg).SetRequestId(requestId));
}
return CoreInternalOutcome(true);
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE23_Relative_Path_Traversal__wchar_t_file_ifstream_06.cpp
Label Definition File: CWE23_Relative_Path_Traversal.label.xml
Template File: sources-sink-06.tmpl.cpp
*/
/*
* @description
* CWE: 23 Relative Path Traversal
* BadSource: file Read input from a file
* GoodSource: Use a fixed file name
* Sink: ifstream
* BadSink : Open the file named in data using ifstream::open()
* Flow Variant: 06 Control flow: if(STATIC_CONST_FIVE==5) and if(STATIC_CONST_FIVE!=5)
*
* */
#include "std_testcase.h"
#ifdef _WIN32
#define BASEPATH L"c:\\temp\\"
#else
#include <wchar.h>
#define BASEPATH L"/tmp/"
#endif
#ifdef _WIN32
#define FILENAME "C:\\temp\\file.txt"
#else
#define FILENAME "/tmp/file.txt"
#endif
#include <fstream>
using namespace std;
/* The variable below is declared "const", so a tool should be able
to identify that reads of this will always give its initialized
value. */
static const int STATIC_CONST_FIVE = 5;
namespace CWE23_Relative_Path_Traversal__wchar_t_file_ifstream_06
{
#ifndef OMITBAD
void bad()
{
wchar_t * data;
wchar_t dataBuffer[FILENAME_MAX] = BASEPATH;
data = dataBuffer;
if(STATIC_CONST_FIVE==5)
{
{
/* Read input from a file */
size_t dataLen = wcslen(data);
FILE * pFile;
/* if there is room in data, attempt to read the input from a file */
if (FILENAME_MAX-dataLen > 1)
{
pFile = fopen(FILENAME, "r");
if (pFile != NULL)
{
/* POTENTIAL FLAW: Read data from a file */
if (fgetws(data+dataLen, (int)(FILENAME_MAX-dataLen), pFile) == NULL)
{
printLine("fgetws() failed");
/* Restore NUL terminator if fgetws fails */
data[dataLen] = L'\0';
}
fclose(pFile);
}
}
}
}
{
ifstream inputFile;
/* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */
inputFile.open((char *)data);
inputFile.close();
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B1() - use goodsource and badsink by changing the STATIC_CONST_FIVE==5 to STATIC_CONST_FIVE!=5 */
static void goodG2B1()
{
wchar_t * data;
wchar_t dataBuffer[FILENAME_MAX] = BASEPATH;
data = dataBuffer;
if(STATIC_CONST_FIVE!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Use a fixed file name */
wcscat(data, L"file.txt");
}
{
ifstream inputFile;
/* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */
inputFile.open((char *)data);
inputFile.close();
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */
static void goodG2B2()
{
wchar_t * data;
wchar_t dataBuffer[FILENAME_MAX] = BASEPATH;
data = dataBuffer;
if(STATIC_CONST_FIVE==5)
{
/* FIX: Use a fixed file name */
wcscat(data, L"file.txt");
}
{
ifstream inputFile;
/* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */
inputFile.open((char *)data);
inputFile.close();
}
}
void good()
{
goodG2B1();
goodG2B2();
}
#endif /* OMITGOOD */
} /* close namespace */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
using namespace CWE23_Relative_Path_Traversal__wchar_t_file_ifstream_06; /* so that we can use good and bad easily */
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
// Copyright Louis Dionne 2013-2016
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
#include <boost/hana/assert.hpp>
#include <boost/hana/at.hpp>
#include <boost/hana/equal.hpp>
#include <boost/hana/experimental/view.hpp>
#include <boost/hana/integral_constant.hpp>
#include <laws/base.hpp>
#include <support/seq.hpp>
namespace hana = boost::hana;
using hana::test::ct_eq;
int main() {
auto container = ::seq;
{
auto storage1 = container(ct_eq<0>{});
auto storage2 = container();
auto joined = hana::experimental::joined(storage1, storage2);
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::at(joined, hana::size_c<0>),
ct_eq<0>{}
));
}{
auto storage1 = container();
auto storage2 = container(ct_eq<0>{});
auto joined = hana::experimental::joined(storage1, storage2);
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::at(joined, hana::size_c<0>),
ct_eq<0>{}
));
}
{
auto storage1 = container(ct_eq<0>{}, ct_eq<1>{});
auto storage2 = container();
auto joined = hana::experimental::joined(storage1, storage2);
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::at(joined, hana::size_c<0>),
ct_eq<0>{}
));
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::at(joined, hana::size_c<1>),
ct_eq<1>{}
));
}{
auto storage1 = container(ct_eq<0>{});
auto storage2 = container(ct_eq<1>{});
auto joined = hana::experimental::joined(storage1, storage2);
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::at(joined, hana::size_c<0>),
ct_eq<0>{}
));
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::at(joined, hana::size_c<1>),
ct_eq<1>{}
));
}{
auto storage1 = container();
auto storage2 = container(ct_eq<0>{}, ct_eq<1>{});
auto joined = hana::experimental::joined(storage1, storage2);
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::at(joined, hana::size_c<0>),
ct_eq<0>{}
));
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::at(joined, hana::size_c<1>),
ct_eq<1>{}
));
}
{
auto storage1 = container(ct_eq<0>{}, ct_eq<1>{});
auto storage2 = container(ct_eq<2>{}, ct_eq<3>{});
auto joined = hana::experimental::joined(storage1, storage2);
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::at(joined, hana::size_c<0>),
ct_eq<0>{}
));
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::at(joined, hana::size_c<1>),
ct_eq<1>{}
));
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::at(joined, hana::size_c<2>),
ct_eq<2>{}
));
BOOST_HANA_CONSTANT_CHECK(hana::equal(
hana::at(joined, hana::size_c<3>),
ct_eq<3>{}
));
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
#include "datalake_service_client_test.hpp"
#include <algorithm>
namespace Azure { namespace Storage { namespace Test {
const size_t c_FILE_SYSTEM_TEST_SIZE = 5;
std::shared_ptr<Files::DataLake::DataLakeServiceClient>
DataLakeServiceClientTest::m_dataLakeServiceClient;
std::vector<std::string> DataLakeServiceClientTest::m_fileSystemNameSetA;
std::vector<std::string> DataLakeServiceClientTest::m_fileSystemNameSetB;
std::string DataLakeServiceClientTest::m_fileSystemPrefixA;
std::string DataLakeServiceClientTest::m_fileSystemPrefixB;
void DataLakeServiceClientTest::SetUpTestSuite()
{
m_dataLakeServiceClient = std::make_shared<Files::DataLake::DataLakeServiceClient>(
Files::DataLake::DataLakeServiceClient::CreateFromConnectionString(
AdlsGen2ConnectionString()));
m_fileSystemPrefixA = LowercaseRandomString(10);
m_fileSystemPrefixB = LowercaseRandomString(10);
m_fileSystemNameSetA.clear();
m_fileSystemNameSetB.clear();
for (size_t i = 0; i < c_FILE_SYSTEM_TEST_SIZE; ++i)
{
{
auto name = m_fileSystemPrefixA + LowercaseRandomString(10);
m_dataLakeServiceClient->GetFileSystemClient(name).Create();
m_fileSystemNameSetA.emplace_back(std::move(name));
}
{
auto name = m_fileSystemPrefixB + LowercaseRandomString(10);
m_dataLakeServiceClient->GetFileSystemClient(name).Create();
m_fileSystemNameSetB.emplace_back(std::move(name));
}
}
}
void DataLakeServiceClientTest::TearDownTestSuite()
{
for (const auto& name : m_fileSystemNameSetA)
{
m_dataLakeServiceClient->GetFileSystemClient(name).Delete();
}
for (const auto& name : m_fileSystemNameSetB)
{
m_dataLakeServiceClient->GetFileSystemClient(name).Delete();
}
}
std::vector<Files::DataLake::Models::FileSystem> DataLakeServiceClientTest::ListAllFileSystems(
const std::string& prefix)
{
std::vector<Files::DataLake::Models::FileSystem> result;
std::string continuation;
Files::DataLake::ListFileSystemsSegmentOptions options;
if (!prefix.empty())
{
options.Prefix = prefix;
}
do
{
auto response = m_dataLakeServiceClient->ListFileSystemsSegement(options);
result.insert(result.end(), response->Filesystems.begin(), response->Filesystems.end());
if (response->ContinuationToken.HasValue())
{
continuation = response->ContinuationToken.GetValue();
options.ContinuationToken = continuation;
}
} while (!continuation.empty());
return result;
}
TEST_F(DataLakeServiceClientTest, ListFileSystemsSegement)
{
{
// Normal list without prefix.
auto result = ListAllFileSystems();
for (const auto& name : m_fileSystemNameSetA)
{
auto iter = std::find_if(
result.begin(),
result.end(),
[&name](const Files::DataLake::Models::FileSystem& fileSystem) {
return fileSystem.Name == name;
});
EXPECT_EQ(iter->Name.substr(0U, m_fileSystemPrefixA.size()), m_fileSystemPrefixA);
EXPECT_NE(result.end(), iter);
}
for (const auto& name : m_fileSystemNameSetB)
{
auto iter = std::find_if(
result.begin(),
result.end(),
[&name](const Files::DataLake::Models::FileSystem& fileSystem) {
return fileSystem.Name == name;
});
EXPECT_EQ(iter->Name.substr(0U, m_fileSystemPrefixB.size()), m_fileSystemPrefixB);
EXPECT_NE(result.end(), iter);
}
}
{
// List prefix.
auto result = ListAllFileSystems(m_fileSystemPrefixA);
for (const auto& name : m_fileSystemNameSetA)
{
auto iter = std::find_if(
result.begin(),
result.end(),
[&name](const Files::DataLake::Models::FileSystem& fileSystem) {
return fileSystem.Name == name;
});
EXPECT_EQ(iter->Name.substr(0U, m_fileSystemPrefixA.size()), m_fileSystemPrefixA);
EXPECT_NE(result.end(), iter);
}
for (const auto& name : m_fileSystemNameSetB)
{
auto iter = std::find_if(
result.begin(),
result.end(),
[&name](const Files::DataLake::Models::FileSystem& fileSystem) {
return fileSystem.Name == name;
});
EXPECT_EQ(result.end(), iter);
}
}
{
// List max result
Files::DataLake::ListFileSystemsSegmentOptions options;
options.MaxResults = 2;
auto response = m_dataLakeServiceClient->ListFileSystemsSegement(options);
EXPECT_LE(2U, response->Filesystems.size());
}
}
TEST_F(DataLakeServiceClientTest, AnonymousConstructorsWorks)
{
auto keyCredential
= Azure::Storage::Details::ParseConnectionString(AdlsGen2ConnectionString()).KeyCredential;
Sas::AccountSasBuilder accountSasBuilder;
accountSasBuilder.Protocol = Sas::SasProtocol::HttpsAndHttp;
accountSasBuilder.StartsOn
= ToIso8601(std::chrono::system_clock::now() - std::chrono::minutes(5));
accountSasBuilder.ExpiresOn
= ToIso8601(std::chrono::system_clock::now() + std::chrono::minutes(60));
accountSasBuilder.Services = Sas::AccountSasServices::Blobs;
accountSasBuilder.ResourceTypes = Sas::AccountSasResource::All;
accountSasBuilder.SetPermissions(Sas::AccountSasPermissions::All);
auto sasToken = accountSasBuilder.GenerateSasToken(*keyCredential);
// Create from Anonymous credential.
auto datalakeServiceUri
= Azure::Storage::Files::DataLake::DataLakeServiceClient::CreateFromConnectionString(
AdlsGen2ConnectionString())
.GetUri();
auto datalakeServiceClient
= Azure::Storage::Files::DataLake::DataLakeServiceClient(datalakeServiceUri + sasToken);
EXPECT_NO_THROW(datalakeServiceClient.ListFileSystemsSegement());
}
}}} // namespace Azure::Storage::Test
|
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <boost/assign/list_of.hpp> // for 'map_list_of()'
#include <boost/foreach.hpp>
#include "checkpoints.h"
#include "txdb.h"
#include "main.h"
#include "uint256.h"
namespace Checkpoints
{
typedef std::map<int, uint256> MapCheckpoints;
//
// What makes a good checkpoint block?
// + Is surrounded by blocks with reasonable timestamps
// (no blocks before with a timestamp after, none after with
// timestamp before)
// + Contains no strange transactions
//
static MapCheckpoints mapCheckpoints =
boost::assign::map_list_of
( 0, hashGenesisBlock )
( 1000, uint256("0x0000000000850dc77a9601bc78cc6404bf24923475194c392accdb176c8e74da"))
( 10000, uint256("0xc304f427bac3bef29e3faf8fe17d483a1e61d3a1749f9a0ac7ece4c1e544bbaa"))
( 50008, uint256("0x00000000000a70b080e12cab200125ecffeebfae7c7fe7c914311a2b1056cf5b"))
(100000, uint256("0x00000000000338c044ce7a397242372cbc5d71ad7bad08c88089d0011de30f83"))
(150006, uint256("0x000000000000b5655b0eb5215167d4e18df3c5a43f67494f0385f87be6956114"))
(200830, uint256("0x000000000000dc867b2fad981c9e4ead671ebe1e0069ba7c9f43ba5a8ef67a07"))
(250008, uint256("0x00000000000069afef0ee5775301da6815092c4bd1a45928e33da5a894e55e00"))
(300836, uint256("0x00000000000047d897f3eac5fcacc831f0f77dfbf70222467ee2360dcbc4b266"))
(350003, uint256("0x0000000000001e6123edc0c5c8ca04ccee16aeb23455d02f12ba8d636516ee52"))
(400002, uint256("0x0000000000002945e035c7fabd433932269af99f5c033a6c9cea229b67751ba1"))
(450000, uint256("0x0000000000009bee8de0c52e5f4ea17a69e044b39718b62824eb67768ad18f4e"))
(468575, uint256("0x0000000000002a6d7dd5d400cf3e57c527f1770c1502cb38ba4b0695c0ebaed5"))
;
// TestNet has no checkpoints
static MapCheckpoints mapCheckpointsTestnet =
boost::assign::map_list_of
( 0, hashGenesisBlockTestNet )
;
bool CheckHardened(int nHeight, const uint256& hash)
{
MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
MapCheckpoints::const_iterator i = checkpoints.find(nHeight);
if (i == checkpoints.end()) return true;
return hash == i->second;
}
int GetTotalBlocksEstimate()
{
MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
return checkpoints.rbegin()->first;
}
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex)
{
MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints)
{
const uint256& hash = i.second;
std::map<uint256, CBlockIndex*>::const_iterator t = mapBlockIndex.find(hash);
if (t != mapBlockIndex.end())
return t->second;
}
return NULL;
}
// FItAllCoin: synchronized checkpoint (centrally broadcasted)
uint256 hashSyncCheckpoint = 0;
uint256 hashPendingCheckpoint = 0;
CSyncCheckpoint checkpointMessage;
CSyncCheckpoint checkpointMessagePending;
uint256 hashInvalidCheckpoint = 0;
CCriticalSection cs_hashSyncCheckpoint;
// FItAllCoin: get last synchronized checkpoint
CBlockIndex* GetLastSyncCheckpoint()
{
LOCK(cs_hashSyncCheckpoint);
if (!mapBlockIndex.count(hashSyncCheckpoint))
error("GetSyncCheckpoint: block index missing for current sync-checkpoint %s", hashSyncCheckpoint.ToString().c_str());
else
return mapBlockIndex[hashSyncCheckpoint];
return NULL;
}
// FItAllCoin: only descendant of current sync-checkpoint is allowed
bool ValidateSyncCheckpoint(uint256 hashCheckpoint)
{
if (!mapBlockIndex.count(hashSyncCheckpoint))
return error("ValidateSyncCheckpoint: block index missing for current sync-checkpoint %s", hashSyncCheckpoint.ToString().c_str());
if (!mapBlockIndex.count(hashCheckpoint))
return error("ValidateSyncCheckpoint: block index missing for received sync-checkpoint %s", hashCheckpoint.ToString().c_str());
CBlockIndex* pindexSyncCheckpoint = mapBlockIndex[hashSyncCheckpoint];
CBlockIndex* pindexCheckpointRecv = mapBlockIndex[hashCheckpoint];
if (pindexCheckpointRecv->nHeight <= pindexSyncCheckpoint->nHeight)
{
// Received an older checkpoint, trace back from current checkpoint
// to the same height of the received checkpoint to verify
// that current checkpoint should be a descendant block
CBlockIndex* pindex = pindexSyncCheckpoint;
while (pindex->nHeight > pindexCheckpointRecv->nHeight)
if (!(pindex = pindex->pprev))
return error("ValidateSyncCheckpoint: pprev null - block index structure failure");
if (pindex->GetBlockHash() != hashCheckpoint)
{
hashInvalidCheckpoint = hashCheckpoint;
return error("ValidateSyncCheckpoint: new sync-checkpoint %s is conflicting with current sync-checkpoint %s", hashCheckpoint.ToString().c_str(), hashSyncCheckpoint.ToString().c_str());
}
return false; // ignore older checkpoint
}
// Received checkpoint should be a descendant block of the current
// checkpoint. Trace back to the same height of current checkpoint
// to verify.
CBlockIndex* pindex = pindexCheckpointRecv;
while (pindex->nHeight > pindexSyncCheckpoint->nHeight)
if (!(pindex = pindex->pprev))
return error("ValidateSyncCheckpoint: pprev2 null - block index structure failure");
if (pindex->GetBlockHash() != hashSyncCheckpoint)
{
hashInvalidCheckpoint = hashCheckpoint;
return error("ValidateSyncCheckpoint: new sync-checkpoint %s is not a descendant of current sync-checkpoint %s", hashCheckpoint.ToString().c_str(), hashSyncCheckpoint.ToString().c_str());
}
return true;
}
bool WriteSyncCheckpoint(const uint256& hashCheckpoint)
{
CTxDB txdb;
txdb.TxnBegin();
if (!txdb.WriteSyncCheckpoint(hashCheckpoint))
{
txdb.TxnAbort();
return error("WriteSyncCheckpoint(): failed to write to db sync checkpoint %s", hashCheckpoint.ToString().c_str());
}
if (!txdb.TxnCommit())
return error("WriteSyncCheckpoint(): failed to commit to db sync checkpoint %s", hashCheckpoint.ToString().c_str());
Checkpoints::hashSyncCheckpoint = hashCheckpoint;
return true;
}
bool AcceptPendingSyncCheckpoint()
{
LOCK(cs_hashSyncCheckpoint);
if (hashPendingCheckpoint != 0 && mapBlockIndex.count(hashPendingCheckpoint))
{
if (!ValidateSyncCheckpoint(hashPendingCheckpoint))
{
hashPendingCheckpoint = 0;
checkpointMessagePending.SetNull();
return false;
}
CTxDB txdb;
CBlockIndex* pindexCheckpoint = mapBlockIndex[hashPendingCheckpoint];
if (!pindexCheckpoint->IsInMainChain())
{
CBlock block;
if (!block.ReadFromDisk(pindexCheckpoint))
return error("AcceptPendingSyncCheckpoint: ReadFromDisk failed for sync checkpoint %s", hashPendingCheckpoint.ToString().c_str());
if (!block.SetBestChain(txdb, pindexCheckpoint))
{
hashInvalidCheckpoint = hashPendingCheckpoint;
return error("AcceptPendingSyncCheckpoint: SetBestChain failed for sync checkpoint %s", hashPendingCheckpoint.ToString().c_str());
}
}
if (!WriteSyncCheckpoint(hashPendingCheckpoint))
return error("AcceptPendingSyncCheckpoint(): failed to write sync checkpoint %s", hashPendingCheckpoint.ToString().c_str());
hashPendingCheckpoint = 0;
checkpointMessage = checkpointMessagePending;
checkpointMessagePending.SetNull();
printf("AcceptPendingSyncCheckpoint : sync-checkpoint at %s\n", hashSyncCheckpoint.ToString().c_str());
// relay the checkpoint
if (!checkpointMessage.IsNull())
{
BOOST_FOREACH(CNode* pnode, vNodes)
checkpointMessage.RelayTo(pnode);
}
return true;
}
return false;
}
// Automatically select a suitable sync-checkpoint
uint256 AutoSelectSyncCheckpoint()
{
const CBlockIndex *pindex = pindexBest;
// Search backward for a block within max span and maturity window
while (pindex->pprev && (pindex->GetBlockTime() + CHECKPOINT_MAX_SPAN > pindexBest->GetBlockTime() || pindex->nHeight + 8 > pindexBest->nHeight))
pindex = pindex->pprev;
return pindex->GetBlockHash();
}
// Check against synchronized checkpoint
bool CheckSync(const uint256& hashBlock, const CBlockIndex* pindexPrev)
{
if (fTestNet) return true; // Testnet has no checkpoints
int nHeight = pindexPrev->nHeight + 1;
LOCK(cs_hashSyncCheckpoint);
// sync-checkpoint should always be accepted block
assert(mapBlockIndex.count(hashSyncCheckpoint));
const CBlockIndex* pindexSync = mapBlockIndex[hashSyncCheckpoint];
if (nHeight > pindexSync->nHeight)
{
// trace back to same height as sync-checkpoint
const CBlockIndex* pindex = pindexPrev;
while (pindex->nHeight > pindexSync->nHeight)
if (!(pindex = pindex->pprev))
return error("CheckSync: pprev null - block index structure failure");
if (pindex->nHeight < pindexSync->nHeight || pindex->GetBlockHash() != hashSyncCheckpoint)
return false; // only descendant of sync-checkpoint can pass check
}
if (nHeight == pindexSync->nHeight && hashBlock != hashSyncCheckpoint)
return false; // same height with sync-checkpoint
if (nHeight < pindexSync->nHeight && !mapBlockIndex.count(hashBlock))
return false; // lower height than sync-checkpoint
return true;
}
bool WantedByPendingSyncCheckpoint(uint256 hashBlock)
{
LOCK(cs_hashSyncCheckpoint);
if (hashPendingCheckpoint == 0)
return false;
if (hashBlock == hashPendingCheckpoint)
return true;
if (mapOrphanBlocks.count(hashPendingCheckpoint)
&& hashBlock == WantedByOrphan(mapOrphanBlocks[hashPendingCheckpoint]))
return true;
return false;
}
// FItAllCoin: reset synchronized checkpoint to last hardened checkpoint
bool ResetSyncCheckpoint()
{
LOCK(cs_hashSyncCheckpoint);
const uint256& hash = mapCheckpoints.rbegin()->second;
if (mapBlockIndex.count(hash) && !mapBlockIndex[hash]->IsInMainChain())
{
// checkpoint block accepted but not yet in main chain
printf("ResetSyncCheckpoint: SetBestChain to hardened checkpoint %s\n", hash.ToString().c_str());
CTxDB txdb;
CBlock block;
if (!block.ReadFromDisk(mapBlockIndex[hash]))
return error("ResetSyncCheckpoint: ReadFromDisk failed for hardened checkpoint %s", hash.ToString().c_str());
if (!block.SetBestChain(txdb, mapBlockIndex[hash]))
{
return error("ResetSyncCheckpoint: SetBestChain failed for hardened checkpoint %s", hash.ToString().c_str());
}
}
else if(!mapBlockIndex.count(hash))
{
// checkpoint block not yet accepted
hashPendingCheckpoint = hash;
checkpointMessagePending.SetNull();
printf("ResetSyncCheckpoint: pending for sync-checkpoint %s\n", hashPendingCheckpoint.ToString().c_str());
}
BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, mapCheckpoints)
{
const uint256& hash = i.second;
if (mapBlockIndex.count(hash) && mapBlockIndex[hash]->IsInMainChain())
{
if (!WriteSyncCheckpoint(hash))
return error("ResetSyncCheckpoint: failed to write sync checkpoint %s", hash.ToString().c_str());
printf("ResetSyncCheckpoint: sync-checkpoint reset to %s\n", hashSyncCheckpoint.ToString().c_str());
return true;
}
}
return false;
}
void AskForPendingSyncCheckpoint(CNode* pfrom)
{
LOCK(cs_hashSyncCheckpoint);
if (pfrom && hashPendingCheckpoint != 0 && (!mapBlockIndex.count(hashPendingCheckpoint)) && (!mapOrphanBlocks.count(hashPendingCheckpoint)))
pfrom->AskFor(CInv(MSG_BLOCK, hashPendingCheckpoint));
}
bool SetCheckpointPrivKey(std::string strPrivKey)
{
// Test signing a sync-checkpoint with genesis block
CSyncCheckpoint checkpoint;
checkpoint.hashCheckpoint = !fTestNet ? hashGenesisBlock : hashGenesisBlockTestNet;
CDataStream sMsg(SER_NETWORK, PROTOCOL_VERSION);
sMsg << (CUnsignedSyncCheckpoint)checkpoint;
checkpoint.vchMsg = std::vector<unsigned char>(sMsg.begin(), sMsg.end());
std::vector<unsigned char> vchPrivKey = ParseHex(strPrivKey);
CKey key;
key.SetPrivKey(CPrivKey(vchPrivKey.begin(), vchPrivKey.end())); // if key is not correct openssl may crash
if (!key.Sign(Hash(checkpoint.vchMsg.begin(), checkpoint.vchMsg.end()), checkpoint.vchSig))
return false;
// Test signing successful, proceed
CSyncCheckpoint::strMasterPrivKey = strPrivKey;
return true;
}
bool SendSyncCheckpoint(uint256 hashCheckpoint)
{
CSyncCheckpoint checkpoint;
checkpoint.hashCheckpoint = hashCheckpoint;
CDataStream sMsg(SER_NETWORK, PROTOCOL_VERSION);
sMsg << (CUnsignedSyncCheckpoint)checkpoint;
checkpoint.vchMsg = std::vector<unsigned char>(sMsg.begin(), sMsg.end());
if (CSyncCheckpoint::strMasterPrivKey.empty())
return error("SendSyncCheckpoint: Checkpoint master key unavailable.");
std::vector<unsigned char> vchPrivKey = ParseHex(CSyncCheckpoint::strMasterPrivKey);
CKey key;
key.SetPrivKey(CPrivKey(vchPrivKey.begin(), vchPrivKey.end())); // if key is not correct openssl may crash
if (!key.Sign(Hash(checkpoint.vchMsg.begin(), checkpoint.vchMsg.end()), checkpoint.vchSig))
return error("SendSyncCheckpoint: Unable to sign checkpoint, check private key?");
if(!checkpoint.ProcessSyncCheckpoint(NULL))
{
printf("WARNING: SendSyncCheckpoint: Failed to process checkpoint.\n");
return false;
}
// Relay checkpoint
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
checkpoint.RelayTo(pnode);
}
return true;
}
// Is the sync-checkpoint outside maturity window?
bool IsMatureSyncCheckpoint()
{
LOCK(cs_hashSyncCheckpoint);
// sync-checkpoint should always be accepted block
assert(mapBlockIndex.count(hashSyncCheckpoint));
const CBlockIndex* pindexSync = mapBlockIndex[hashSyncCheckpoint];
return (nBestHeight >= pindexSync->nHeight + nCoinbaseMaturity ||
pindexSync->GetBlockTime() + nStakeMinAge < GetAdjustedTime());
}
}
// FItAllCoin: sync-checkpoint master key
const std::string CSyncCheckpoint::strMasterPubKey = "040ca85222159767e5ef1e9640418ddaf37990c3c62e13f5d52cc9620ef1597d7571cf35f670c176f1f28fabcf371d0eadfee616c0ee5385600eaeba3482f3bac2";
std::string CSyncCheckpoint::strMasterPrivKey = "";
// FItAllCoin: verify signature of sync-checkpoint message
bool CSyncCheckpoint::CheckSignature()
{
CKey key;
if (!key.SetPubKey(ParseHex(CSyncCheckpoint::strMasterPubKey)))
return error("CSyncCheckpoint::CheckSignature() : SetPubKey failed");
if (!key.Verify(Hash(vchMsg.begin(), vchMsg.end()), vchSig))
return error("CSyncCheckpoint::CheckSignature() : verify signature failed");
// Now unserialize the data
CDataStream sMsg(vchMsg, SER_NETWORK, PROTOCOL_VERSION);
sMsg >> *(CUnsignedSyncCheckpoint*)this;
return true;
}
// FItAllCoin: process synchronized checkpoint
bool CSyncCheckpoint::ProcessSyncCheckpoint(CNode* pfrom)
{
if (!CheckSignature())
return false;
LOCK(Checkpoints::cs_hashSyncCheckpoint);
if (!mapBlockIndex.count(hashCheckpoint))
{
// We haven't received the checkpoint chain, keep the checkpoint as pending
Checkpoints::hashPendingCheckpoint = hashCheckpoint;
Checkpoints::checkpointMessagePending = *this;
printf("ProcessSyncCheckpoint: pending for sync-checkpoint %s\n", hashCheckpoint.ToString().c_str());
// Ask this guy to fill in what we're missing
if (pfrom)
{
pfrom->PushGetBlocks(pindexBest, hashCheckpoint);
// ask directly as well in case rejected earlier by duplicate
// proof-of-stake because getblocks may not get it this time
pfrom->AskFor(CInv(MSG_BLOCK, mapOrphanBlocks.count(hashCheckpoint)? WantedByOrphan(mapOrphanBlocks[hashCheckpoint]) : hashCheckpoint));
}
return false;
}
if (!Checkpoints::ValidateSyncCheckpoint(hashCheckpoint))
return false;
CTxDB txdb;
CBlockIndex* pindexCheckpoint = mapBlockIndex[hashCheckpoint];
if (!pindexCheckpoint->IsInMainChain())
{
// checkpoint chain received but not yet main chain
CBlock block;
if (!block.ReadFromDisk(pindexCheckpoint))
return error("ProcessSyncCheckpoint: ReadFromDisk failed for sync checkpoint %s", hashCheckpoint.ToString().c_str());
if (!block.SetBestChain(txdb, pindexCheckpoint))
{
Checkpoints::hashInvalidCheckpoint = hashCheckpoint;
return error("ProcessSyncCheckpoint: SetBestChain failed for sync checkpoint %s", hashCheckpoint.ToString().c_str());
}
}
if (!Checkpoints::WriteSyncCheckpoint(hashCheckpoint))
return error("ProcessSyncCheckpoint(): failed to write sync checkpoint %s", hashCheckpoint.ToString().c_str());
Checkpoints::checkpointMessage = *this;
Checkpoints::hashPendingCheckpoint = 0;
Checkpoints::checkpointMessagePending.SetNull();
printf("ProcessSyncCheckpoint: sync-checkpoint at %s\n", hashCheckpoint.ToString().c_str());
return true;
}
|
#include "Halide.h"
#include <stdio.h>
using namespace Halide;
Var x("x"), y("y"), c("c");
Var xo("xo"), yo("yo"), xi("xi"), yi("yi");
uint8_t phase = 0;
class HalidePipeline {
public:
ImageParam input;
std::vector<Argument> args;
//Param<uint8_t> phase; // One bit each for x and y phase
Func padded;
Func red, green, blue;
Func demosaic, lowpass_x, lowpass_y, downsample;
Func output, hw_output;
Func neswNeighbors, diagNeighbors, vNeighbors, hNeighbors;
HalidePipeline()
: input(UInt(8), 2), padded("padded"),
demosaic("demosaic"), lowpass_x("lowpass_x"),
lowpass_y("lowpass_y"), downsample("downsample"),
output("output"), hw_output("offload")
{
padded = BoundaryConditions::repeat_edge(input);
//padded(x, y) = input(x+240, y+60);
//padded(x, y) = input(x+200, y+40);
// Now demosaic and try to get RGB back
Func padded16;
padded16(x, y) = cast<uint16_t>(padded(x, y));
neswNeighbors(x, y) = cast<uint8_t>((padded16(x-1, y) + padded16(x+1, y) +
padded16(x, y-1) + padded16(x, y+1))/4);
diagNeighbors(x, y) = cast<uint8_t>((padded16(x-1, y-1) + padded16(x+1, y-1) +
padded16(x-1, y+1) + padded16(x+1, y+1))/4);
vNeighbors(x, y) = cast<uint8_t>((padded16(x, y-1) + padded16(x, y+1))/2);
hNeighbors(x, y) = cast<uint8_t>((padded16(x-1, y) + padded16(x+1, y))/2);
green(x, y) = select((y % 2) == (phase / 2),
select((x % 2) == (phase % 2), neswNeighbors(x, y), padded(x, y)), // First row, RG
select((x % 2) == (phase % 2), padded(x, y), neswNeighbors(x, y))); // Second row, GB
red(x, y) = select((y % 2) == (phase / 2),
select((x % 2) == (phase % 2), padded(x, y), hNeighbors(x, y)), // First row, RG
select((x % 2) == (phase % 2), vNeighbors(x, y), diagNeighbors(x, y))); // Second row, GB
blue(x, y) = select((y % 2) == (phase / 2),
select((x % 2) == (phase % 2), diagNeighbors(x, y), vNeighbors(x, y)), // First row, RG
select((x % 2) == (phase % 2), hNeighbors(x, y), padded(x, y))); // Second row, GB
demosaic(c, x, y) = cast<uint8_t>(select(c == 0, red(x, y),
c == 1, green(x, y),
blue(x, y)));
// lowpass filter before downsample
lowpass_y(c, x, y) = cast<uint8_t>((cast<uint16_t>(demosaic(c, x, y)) +
cast<uint16_t>(demosaic(c, x+1, y)))/2);
lowpass_x(c, x, y) = cast<uint8_t>((cast<uint16_t>(lowpass_y(c, x, y)) +
cast<uint16_t>(lowpass_y(c, x, y+1)))/2);
//hw_output(c, x, y) = demosaic(c, x, y);
hw_output(c, x, y) = lowpass_x(c, x, y);
// downsample
downsample(c, x, y) = hw_output(c, x*2, y*2);
output(x, y, c) = downsample(c, x, y);
//output(x, y, c) = hw_output(c, x, y);
// common constraints
output.bound(c, 0, 3);
// Arguments
args = {input};
// We can generate slightly better code if we know the output is a whole number of tiles.
output.bound(x, 0, 480).bound(y, 0, 640);
}
void compile_to_cpu() {
output.compile_to_lowered_stmt("ir.cpu.html", {input}, HTML);
output.compile_to_c("cpu.cpp", {input}, "cpu");
output.compile_to_header("cpu.h", {input}, "cpu");
std::cerr << "Compiled...\n";
}
void compile_to_hls() {
std::cout << "\ncompiling HLS code..." << std::endl;
padded.compute_root();
hw_output.compute_root();
hw_output.tile(x, y, xo, yo, xi, yi, 480, 640).reorder(c, xi, yi, xo, yo);
hw_output.offload({demosaic.unroll(c), lowpass_x.unroll(c)}, xo).unroll(c);
//output.print_loop_nest();
// Create the target for HLS simulation
output.compile_to_lowered_stmt("ir.hls.html", args, HTML);
output.compile_to_sdsoc("top", args, "top");
}
};
int main(int argc, char **argv) {
if (argc != 1 && argc != 2) {
std::cerr << "Usage: ./generator <target>\n";
std::cerr << "By default, it is targetted to native CPU code.\n";
return 1;
}
if (argc == 1 || !strcmp(argv[1], "CPU")) {
HalidePipeline().compile_to_cpu();
} else if (!strcmp(argv[1], "HLS")) {
HalidePipeline().compile_to_hls();
}
return 0;
}
|
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "NFAtoDFA.h"
#include "RegexParser.h"
#include <fstream>
#include <sstream>
#include <string>
/**
* Processes a .lex file and produces .h and .cpp files which implement a lexical analyzer. The .lex
* file is a text file with one token definition per line. Each line is of the form:
* <TOKEN_NAME> = <pattern>
* where <pattern> is either a regular expression (e.g [0-9]) or a double-quoted literal string.
*/
static constexpr const char* HEADER =
"/*\n"
" * Copyright 2017 Google Inc.\n"
" *\n"
" * Use of this source code is governed by a BSD-style license that can be\n"
" * found in the LICENSE file.\n"
" */\n"
"/*****************************************************************************************\n"
" ******************** This file was generated by sksllex. Do not edit. *******************\n"
" *****************************************************************************************/\n";
void writeH(const DFA& dfa, const char* lexer, const char* token,
const std::vector<std::string>& tokens, const char* hPath) {
std::ofstream out(hPath);
ASSERT(out.good());
out << HEADER;
out << "#ifndef SKSL_" << lexer << "\n";
out << "#define SKSL_" << lexer << "\n";
out << "#include <cstddef>\n";
out << "#include <cstdint>\n";
out << "namespace SkSL {\n";
out << "\n";
out << "struct " << token << " {\n";
out << " enum Kind {\n";
for (const std::string& t : tokens) {
out << " #undef " << t << "\n";
out << " " << t << ",\n";
}
out << " };\n";
out << "\n";
out << " " << token << "()\n";
out << " : fKind(Kind::INVALID)\n";
out << " , fOffset(-1)\n";
out << " , fLength(-1) {}\n";
out << "\n";
out << " " << token << "(Kind kind, int offset, int length)\n";
out << " : fKind(kind)\n";
out << " , fOffset(offset)\n";
out << " , fLength(length) {}\n";
out << "\n";
out << " Kind fKind;\n";
out << " int fOffset;\n";
out << " int fLength;\n";
out << "};\n";
out << "\n";
out << "class " << lexer << " {\n";
out << "public:\n";
out << " void start(const char* text, size_t length) {\n";
out << " fText = text;\n";
out << " fLength = length;\n";
out << " fOffset = 0;\n";
out << " }\n";
out << "\n";
out << " " << token << " next();\n";
out << "\n";
out << "private:\n";
out << " const char* fText;\n";
out << " int fLength;\n";
out << " int fOffset;\n";
out << "};\n";
out << "\n";
out << "} // namespace\n";
out << "#endif\n";
}
void writeCPP(const DFA& dfa, const char* lexer, const char* token, const char* include,
const char* cppPath) {
std::ofstream out(cppPath);
ASSERT(out.good());
out << HEADER;
out << "#include \"" << include << "\"\n";
out << "\n";
out << "namespace SkSL {\n";
out << "\n";
size_t states = 0;
for (const auto& row : dfa.fTransitions) {
states = std::max(states, row.size());
}
out << "static int16_t mappings[" << dfa.fCharMappings.size() << "] = {\n ";
const char* separator = "";
for (int m : dfa.fCharMappings) {
out << separator << std::to_string(m);
separator = ", ";
}
out << "\n};\n";
out << "static int16_t transitions[" << dfa.fTransitions.size() << "][" << states << "] = {\n";
for (size_t c = 0; c < dfa.fTransitions.size(); ++c) {
out << " {";
for (size_t j = 0; j < states; ++j) {
if ((size_t) c < dfa.fTransitions.size() && j < dfa.fTransitions[c].size()) {
out << " " << dfa.fTransitions[c][j] << ",";
} else {
out << " 0,";
}
}
out << " },\n";
}
out << "};\n";
out << "\n";
out << "static int8_t accepts[" << states << "] = {";
for (size_t i = 0; i < states; ++i) {
if (i < dfa.fAccepts.size()) {
out << " " << dfa.fAccepts[i] << ",";
} else {
out << " " << INVALID << ",";
}
}
out << " };\n";
out << "\n";
out << token << " " << lexer << "::next() {\n";;
out << " int startOffset = fOffset;\n";
out << " if (startOffset == fLength) {\n";
out << " return " << token << "(" << token << "::END_OF_FILE, startOffset, 0);\n";
out << " }\n";
out << " int offset = startOffset;\n";
out << " int state = 1;\n";
out << " " << token << "::Kind lastAccept = " << token << "::Kind::INVALID;\n";
out << " int lastAcceptEnd = startOffset + 1;\n";
out << " while (offset < fLength) {\n";
out << " state = transitions[mappings[(int) fText[offset]]][state];\n";
out << " ++offset;\n";
out << " if (!state) {\n";
out << " break;\n";
out << " }\n";
out << " if (accepts[state]) {\n";
out << " lastAccept = (" << token << "::Kind) accepts[state];\n";
out << " lastAcceptEnd = offset;\n";
out << " }\n";
out << " }\n";
out << " fOffset = lastAcceptEnd;\n";
out << " return " << token << "(lastAccept, startOffset, lastAcceptEnd - startOffset);\n";
out << "}\n";
out << "\n";
out << "} // namespace\n";
}
void process(const char* inPath, const char* lexer, const char* token, const char* hPath,
const char* cppPath) {
NFA nfa;
std::vector<std::string> tokens;
tokens.push_back("END_OF_FILE");
std::string line;
std::ifstream in(inPath);
while (std::getline(in, line)) {
std::istringstream split(line);
std::string name, delimiter, pattern;
if (split >> name >> delimiter >> pattern) {
ASSERT(split.eof());
ASSERT(name != "");
ASSERT(delimiter == "=");
ASSERT(pattern != "");
tokens.push_back(name);
if (pattern[0] == '"') {
ASSERT(pattern.size() > 2 && pattern[pattern.size() - 1] == '"');
RegexNode node = RegexNode(RegexNode::kChar_Kind, pattern[1]);
for (size_t i = 2; i < pattern.size() - 1; ++i) {
node = RegexNode(RegexNode::kConcat_Kind, node,
RegexNode(RegexNode::kChar_Kind, pattern[i]));
}
nfa.addRegex(node);
}
else {
nfa.addRegex(RegexParser().parse(pattern));
}
}
}
NFAtoDFA converter(&nfa);
DFA dfa = converter.convert();
writeH(dfa, lexer, token, tokens, hPath);
writeCPP(dfa, lexer, token, (std::string("SkSL") + lexer + ".h").c_str(), cppPath);
}
int main(int argc, const char** argv) {
if (argc != 6) {
printf("usage: sksllex <input.lex> <lexername> <tokenname> <output.h> <output.cpp>\n");
exit(1);
}
process(argv[1], argv[2], argv[3], argv[4], argv[5]);
return 0;
}
|
/*
* Copyright (c) 2008-2010
* Nakata, Maho
* All rights reserved.
*
* $Id: Rstemr.cpp,v 1.3 2010/08/07 04:48:33 nakatamaho Exp $
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*
Copyright (c) 1992-2007 The University of Tennessee. All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer listed
in this license in the documentation and/or other materials
provided with the distribution.
- Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <mblas.h>
#include <mlapack.h>
#define MTRUE 1
#define MFALSE 0
void Rstemr(const char *jobz, const char *range, INTEGER n, REAL *
d, REAL * e, REAL vl, REAL vu, INTEGER il, INTEGER iu, INTEGER * m, REAL * w, REAL * z, INTEGER ldz,
INTEGER nzc, INTEGER * isuppz, LOGICAL * tryrac, REAL * work, INTEGER lwork, INTEGER * iwork, INTEGER liwork, INTEGER * info)
{
INTEGER i, j;
REAL r1, r2;
INTEGER jj;
REAL cs;
INTEGER in;
REAL sn, wl, wu;
INTEGER iil, iiu;
REAL eps, tmp;
INTEGER indd, iend, jblk, wend;
REAL rmin, rmax;
INTEGER itmp;
REAL tnrm;
INTEGER inde2, itmp2;
REAL rtol1, rtol2;
REAL scale;
INTEGER indgp;
INTEGER iinfo, iindw, ilast;
INTEGER lwmin;
LOGICAL wantz;
LOGICAL alleig;
INTEGER ibegin;
LOGICAL indeig;
INTEGER iindbl;
LOGICAL valeig;
INTEGER wbegin;
REAL safmin;
REAL bignum;
INTEGER inderr, iindwk, indgrs, offset;
REAL thresh;
INTEGER iinspl, ifirst, indwrk, liwmin, nzcmin;
REAL pivmin;
INTEGER nsplit;
REAL smlnum;
LOGICAL lquery, zquery;
REAL Zero = 0.0, One = 1.0, Four = 4.0, Small = .001;
REAL mtemp1, mtemp2;
//Test the input parameters.
wantz = Mlsame(jobz, "V");
alleig = Mlsame(range, "A");
valeig = Mlsame(range, "V");
indeig = Mlsame(range, "I");
lquery = lwork == -1 || liwork == -1;
zquery = nzc == -1;
*tryrac = *info != 0;
//DSTEMR needs WORK of size 6*N, IWORK of size 3*N.
//In addition, DLARRE needs WORK of size 6*N, IWORK of size 5*N.
//Furthermore, DLARRV needs WORK of size 12*N, IWORK of size 7*N.
if (wantz) {
lwmin = n * 18;
liwmin = n * 10;
} else {
//need less workspace if only the eigenvalues are wanted
lwmin = n * 12;
liwmin = n << 3;
}
wl = Zero;
wu = Zero;
iil = 0;
iiu = 0;
if (valeig) {
//We do not reference VL, VU in the cases RANGE = 'I','A'
//The interval (WL, WU] contains all the wanted eigenvalues.
//It is either given by the user or computed in DLARRE.
wl = vl;
wu = vu;
} else if (indeig) {
//We do not reference IL, IU in the cases RANGE = 'V','A'
iil = il;
iiu = iu;
}
*info = 0;
if (!(wantz || Mlsame(jobz, "N"))) {
*info = -1;
} else if (!(alleig || valeig || indeig)) {
*info = -2;
} else if (n < 0) {
*info = -3;
} else if (valeig && n > 0 && wu <= wl) {
*info = -7;
} else if (indeig && (iil < 1 || iil > n)) {
*info = -8;
} else if (indeig && (iiu < iil || iiu > n)) {
*info = -9;
} else if (ldz < 1 || (wantz && ldz < n)) {
*info = -13;
} else if (lwork < lwmin && !lquery) {
*info = -17;
} else if (liwork < liwmin && !lquery) {
*info = -19;
}
//Get machine constants.
safmin = Rlamch("Safe minimum");
eps = Rlamch("Precision");
smlnum = safmin / eps;
bignum = One / smlnum;
rmin = sqrt(smlnum);
mtemp1 = sqrt(bignum), mtemp2 = One / sqrt(sqrt(safmin));
rmax = min(mtemp1, mtemp2);
if (*info == 0) {
work[1] = lwmin;
iwork[1] = liwmin;
if (wantz && alleig) {
nzcmin = n;
} else if (wantz && valeig) {
Rlarrc("T", n, vl, vu, &d[0], &e[0], safmin, &nzcmin, &itmp, &itmp2, info);
} else if (wantz && indeig) {
nzcmin = iiu - iil + 1;
} else {
//WANTZ .EQ. FALSE.
nzcmin = 0;
}
if (zquery && *info == 0) {
z[ldz + 1] = nzcmin;
} else if (nzc < nzcmin && !zquery) {
*info = -14;
}
}
if (*info != 0) {
Mxerbla("Rstemr", -(*info));
return;
} else if (lquery || zquery) {
return;
}
//Handle N = 0, 1, and 2 cases immediately
(*m) = 0;
if (n == 0) {
return;
}
if (n == 1) {
if (alleig || indeig) {
(*m) = 1;
w[1] = d[1];
} else {
if (wl < d[1] && wu >= d[1]) {
(*m) = 1;
w[1] = d[1];
}
}
if (wantz && !zquery) {
z[ldz + 1] = One;
isuppz[1] = 1;
isuppz[2] = 1;
}
return;
}
if (n == 2) {
if (!wantz) {
Rlae2(d[0], e[0], d[2], &r1, &r2);
} else if (wantz && !zquery) {
Rlaev2(d[0], e[0], d[2], &r1, &r2, &cs, &sn);
}
if (alleig || (valeig && r2 > wl && r2 <= wu) || (indeig && iil == 1)) {
++(*m);
w[(*m)] = r2;
if (wantz && !zquery) {
z[(*m) * ldz + 1] = -sn;
z[(*m) * ldz + 2] = cs;
//Note: At most one of SN and CS can be zero.
if (sn != Zero) {
if (cs != Zero) {
isuppz[((*m) << 1) - 1] = 1;
isuppz[((*m) << 1) - 1] = 2;
} else {
isuppz[((*m) << 1) - 1] = 1;
isuppz[((*m) << 1) - 1] = 1;
}
} else {
isuppz[((*m) << 1) - 1] = 2;
isuppz[(*m) * 2] = 2;
}
}
}
if (alleig || (valeig && r1 > wl && r1 <= wu) || (indeig && iiu == 2)) {
++((*m));
w[(*m)] = r1;
if (wantz && !zquery) {
z[(*m) * ldz + 1] = cs;
z[(*m) * ldz + 2] = sn;
//Note: At most one of SN and CS can be zero.
if (sn != Zero) {
if (cs != Zero) {
isuppz[((*m) << 1) - 1] = 1;
isuppz[((*m) << 1) - 1] = 2;
} else {
isuppz[((*m) << 1) - 1] = 1;
isuppz[((*m) << 1) - 1] = 1;
}
} else {
isuppz[((*m) << 1) - 1] = 2;
isuppz[(*m) * 2] = 2;
}
}
}
return;
}
//Continue with general N
indgrs = 1;
inderr = (n << 1) + 1;
indgp = n * 3 + 1;
indd = (n << 2) + 1;
inde2 = n * 5 + 1;
indwrk = n * 6 + 1;
iinspl = 0;
iindbl = n + 1;
iindw = (n << 1) + 1;
iindwk = n * 3 + 1;
//Scale matrix to allowable range, if necessary.
//The allowable range is related to the PIVMIN parameter; see the
//comments in DLARRD. The preference for scaling small values
//up is heuristic; we expect users' matrices not to be close to the
//RMAX threshold.
scale = One;
tnrm = Rlanst("M", n, &d[0], &e[0]);
if (tnrm > Zero && tnrm < rmin) {
scale = rmin / tnrm;
} else if (tnrm > rmax) {
scale = rmax / tnrm;
}
if (scale != One) {
Rscal(n, scale, &d[0], 1);
Rscal(n - 1, scale, &e[0], 1);
tnrm = tnrm * scale;
if (valeig) {
//If eigenvalues in interval have to be found,
//scale (WL, WU] accordingly
wl = wl * scale;
wu = wu * scale;
}
}
//Compute the desired eigenvalues of the tridiagonal after splitting
//into smaller subblocks if the corresponding off-diagonal elements
//are small
//THRESH is the splitting parameter for DLARRE
//A negative THRESH forces the old splitting criterion based on the
//size of the off-diagonal. A positive THRESH switches to splitting
//which preserves relative accuracy.
if (*tryrac) {
//Test whether the matrix warrants the more expensive relative approach.
Rlarrr(n, &d[0], &e[0], &iinfo);
} else {
//The user does not care about relative accurately eigenvalues
iinfo = -1;
}
//Set the splitting criterion
if (iinfo == 0) {
thresh = eps;
} else {
thresh = -eps;
//relative accuracy is desired but T does not guarantee it
*tryrac = MFALSE;
}
if (*tryrac) {
//Copy original diagonal, needed to guarantee relative accuracy
Rcopy(n, &d[0], 1, &work[indd], 1);
}
//Store the squares of the offdiagonal values of T
for (j = 0; j < n - 1; j++) {
/* Computing 2nd power */
work[inde2 + j - 1] = e[j] * e[j];
}
//Set the tolerance parameters for bisection
if (!wantz) {
//DLARRE computes the eigenvalues to full precision.
rtol1 = eps * Four;
rtol2 = eps * Four;
} else {
//DLARRE computes the eigenvalues to less than full precision.
//DLARRV will refine the eigenvalue approximations, and we can
//need less accurate initial bisection in DLARRE.
//Note: these settings do only affect the subset case and DLARRE
rtol1 = sqrt(eps);
mtemp1 = sqrt(eps) * .005, mtemp2 = eps * Four;
rtol2 = max(mtemp1, mtemp2);
}
Rlarre(range, n, &wl, &wu, iil, iiu, &d[0], &e[0], &work[inde2], rtol1, rtol2, thresh, &nsplit, &iwork[iinspl], m, &w[1],
&work[inderr], &work[indgp], &iwork[iindbl], &iwork[iindw], &work[indgrs], &pivmin, &work[indwrk], &iwork[iindwk], &iinfo);
if (iinfo != 0) {
*info = abs(iinfo) + 10;
return;
}
//Note that if RANGE .NE. 'V', DLARRE computes bounds on the desired
//part of the spectrum. All desired eigenvalues are contained in
//(WL,WU]
if (wantz) {
//Compute the desired eigenvectors corresponding to the computed
//eigenvalues
Rlarrv(n, wl, wu, &d[0], &e[0], pivmin, &iwork[iinspl], (*m), 1, (*m), Small, rtol1, rtol2, &w[0], &work[inderr],
&work[indgp], &iwork[iindbl], &iwork[iindw], &work[indgrs], &z[0], ldz, &isuppz[1], &work[indwrk], &iwork[iindwk], &iinfo);
if (iinfo != 0) {
*info = abs(iinfo) + 20;
return;
}
} else {
//DLARRE computes eigenvalues of the (shifted) root representation
//DLARRV returns the eigenvalues of the unshifted matrix.
//However, if the eigenvectors are not desired by the user, we need
//to apply the corresponding shifts from DLARRE to obtain the
//eigenvalues of the original matrix.
for (j = 0; j < (*m); j++) {
itmp = iwork[iindbl + j - 1];
w[j] = w[j] + e[iwork[iinspl + itmp - 1]];
}
}
if (*tryrac) {
//Refine computed eigenvalues so that they are relatively accurate
//with respect to the original matrix T.
ibegin = 1;
wbegin = 1;
for (jblk = 0; jblk <= iwork[iindbl + (*m) - 1]; jblk++) {
iend = iwork[iinspl + jblk - 1];
in = iend - ibegin + 1;
wend = wbegin - 1;
//check if any eigenvalues have to be refined in this block
L36:
if (wend < (*m)) {
if (iwork[iindbl + wend] == jblk) {
++wend;
goto L36;
}
}
if (wend < wbegin) {
ibegin = iend + 1;
goto L39;
}
offset = iwork[iindw + wbegin - 1] - 1;
ifirst = iwork[iindw + wbegin - 1];
ilast = iwork[iindw + wend - 1];
rtol2 = eps * Four;
Rlarrj(in, &work[indd + ibegin - 1], &work[inde2 + ibegin - 1],
ifirst, ilast, rtol2, offset, &w[wbegin], &work[inderr + wbegin - 1], &work[indwrk], &iwork[iindwk], pivmin, tnrm, &iinfo);
ibegin = iend + 1;
wbegin = wend + 1;
L39:
;
}
}
//If matrix was scaled, then rescale eigenvalues appropriately.
if (scale != One) {
Rscal((*m), One / scale, &w[1], 1);
}
//If eigenvalues are not in increasing order, then sort them,
//possibly along with eigenvectors.
if (nsplit > 1) {
if (!wantz) {
Rlasrt("I", (*m), &w[1], &iinfo);
if (iinfo != 0) {
*info = 3;
return;
}
} else {
for (j = 0; j < (*m) - 1; j++) {
i = 0;
tmp = w[j];
for (jj = j + 1; jj <= (*m); jj++) {
if (w[jj] < tmp) {
i = jj;
tmp = w[jj];
}
}
if (i != 0) {
w[i] = w[j];
w[j] = tmp;
if (wantz) {
Rswap(n, &z[i * ldz + 1], 1, &z[j * ldz + 1], 1);
itmp = isuppz[(i << 1) - 1];
isuppz[(i << 1) - 1] = isuppz[(j << 1) - 1];
isuppz[(j << 1) - 1] = itmp;
itmp = isuppz[i * 2];
isuppz[i * 2] = isuppz[j * 2];
isuppz[j * 2] = itmp;
}
}
}
}
}
work[1] = lwmin;
iwork[1] = liwmin;
return;
}
|
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/interprocess for documentation.
//
//////////////////////////////////////////////////////////////////////////////
//
// Parts of the pthread code come from Boost Threads code:
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2003
// William E. Kempf
//
// Permission to use, copy, modify, distribute and sell this software
// and its documentation for any purpose is hereby granted without fee,
// provided that the above copyright notice appear in all copies and
// that both that copyright notice and this permission notice appear
// in supporting documentation. William E. Kempf makes no representations
// about the suitability of this software for any purpose.
// It is provided "as is" without express or implied warranty.
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTERPROCESS_RECURSIVE_MUTEX_HPP
#define BOOST_INTERPROCESS_RECURSIVE_MUTEX_HPP
/// @cond
#if (defined _MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
#include <boost/assert.hpp>
#if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && \
(defined(BOOST_INTERPROCESS_POSIX_PROCESS_SHARED) && defined (BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES))
#include <pthread.h>
#include <errno.h>
#include <boost/interprocess/sync/posix/pthread_helpers.hpp>
#define BOOST_INTERPROCESS_USE_POSIX
#else
#include <boost/interprocess/sync/emulation/recursive_mutex.hpp>
#define BOOST_INTERPROCESS_USE_GENERIC_EMULATION
#endif
#if defined (BOOST_INTERPROCESS_USE_GENERIC_EMULATION)
namespace boost {
namespace interprocess {
namespace ipcdetail{
namespace robust_emulation_helpers {
template<class T>
class mutex_traits;
}}}}
#endif
/// @endcond
//!\file
//!Describes interprocess_recursive_mutex and shared_recursive_try_mutex classes
namespace boost {
namespace interprocess {
//!Wraps a interprocess_mutex that can be placed in shared memory and can be
//!shared between processes. Allows several locking calls by the same
//!process. Allows timed lock tries
class interprocess_recursive_mutex
{
/// @cond
//Non-copyable
interprocess_recursive_mutex(const interprocess_recursive_mutex &);
interprocess_recursive_mutex &operator=(const interprocess_recursive_mutex &);
/// @endcond
public:
//!Constructor.
//!Throws interprocess_exception on error.
interprocess_recursive_mutex();
//!Destructor. If any process uses the mutex after the destructor is called
//!the result is undefined. Does not throw.
~interprocess_recursive_mutex();
//!Effects: The calling thread tries to obtain ownership of the mutex, and
//! if another thread has ownership of the mutex, it waits until it can
//! obtain the ownership. If a thread takes ownership of the mutex the
//! mutex must be unlocked by the same mutex. The mutex must be unlocked
//! the same number of times it is locked.
//!Throws: interprocess_exception on error.
void lock();
//!Tries to lock the interprocess_mutex, returns false when interprocess_mutex
//!is already locked, returns true when success. The mutex must be unlocked
//!the same number of times it is locked.
//!Throws: interprocess_exception if a severe error is found
bool try_lock();
//!Tries to lock the interprocess_mutex, if interprocess_mutex can't be locked before
//!abs_time time, returns false. The mutex must be unlocked
//! the same number of times it is locked.
//!Throws: interprocess_exception if a severe error is found
bool timed_lock(const boost::posix_time::ptime &abs_time);
//!Effects: The calling thread releases the exclusive ownership of the mutex.
//! If the mutex supports recursive locking, the mutex must be unlocked the
//! same number of times it is locked.
//!Throws: interprocess_exception on error.
void unlock();
/// @cond
private:
#if defined (BOOST_INTERPROCESS_USE_GENERIC_EMULATION)
void take_ownership(){ mutex.take_ownership(); }
friend class ipcdetail::robust_emulation_helpers::mutex_traits<interprocess_recursive_mutex>;
ipcdetail::emulation_recursive_mutex mutex;
#else //#if defined (BOOST_INTERPROCESS_USE_GENERIC_EMULATION)
pthread_mutex_t m_mut;
#endif //#if (defined BOOST_INTERPROCESS_WINDOWS)
/// @endcond
};
} //namespace interprocess {
} //namespace boost {
#ifdef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
# undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION
namespace boost {
namespace interprocess {
inline interprocess_recursive_mutex::interprocess_recursive_mutex(){}
inline interprocess_recursive_mutex::~interprocess_recursive_mutex(){}
inline void interprocess_recursive_mutex::lock()
{
#ifdef BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING
boost::posix_time::ptime wait_time
= boost::posix_time::microsec_clock::universal_time()
+ boost::posix_time::milliseconds(BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS);
if (!mutex.timed_lock(wait_time))
{
throw interprocess_exception(timeout_when_locking_error, "Interprocess mutex timeout when locking. Possible deadlock: owner died without unlocking?");
}
#else
mutex.lock();
#endif
}
inline bool interprocess_recursive_mutex::try_lock(){ return mutex.try_lock(); }
inline bool interprocess_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs_time){ return mutex.timed_lock(abs_time); }
inline void interprocess_recursive_mutex::unlock(){ mutex.unlock(); }
} //namespace interprocess {
} //namespace boost {
#endif
#ifdef BOOST_INTERPROCESS_USE_POSIX
# undef BOOST_INTERPROCESS_USE_POSIX
#include <boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp>
#endif
#include <boost/interprocess/detail/config_end.hpp>
#endif //BOOST_INTERPROCESS_RECURSIVE_MUTEX_HPP
|
#include "globals.h"
#include "flags.h"
#include "fluxmap.h"
#include "usb.h"
#include "fluxsink/fluxsink.h"
FlagGroup hardwareFluxSinkFlags;
static bool high_density = false;
static IntFlag indexMode(
{ "--write-index-mode" },
"index pulse source (0=drive, 1=300 RPM fake source, 2=360 RPM fake source",
0);
void setHardwareFluxSinkDensity(bool high_density)
{
::high_density = high_density;
}
class HardwareFluxSink : public FluxSink
{
public:
HardwareFluxSink(unsigned drive):
_drive(drive)
{
}
~HardwareFluxSink()
{
}
public:
void writeFlux(int track, int side, Fluxmap& fluxmap)
{
usbSetDrive(_drive, high_density, indexMode);
usbSeek(track);
Bytes crunched = fluxmap.rawBytes().crunch();
return usbWrite(side, crunched);
}
private:
unsigned _drive;
};
std::unique_ptr<FluxSink> FluxSink::createHardwareFluxSink(unsigned drive)
{
return std::unique_ptr<FluxSink>(new HardwareFluxSink(drive));
}
|
// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/compiler/simplified-operator.h"
#include "include/v8-fast-api-calls.h"
#include "src/base/lazy-instance.h"
#include "src/compiler/opcodes.h"
#include "src/compiler/operator.h"
#include "src/compiler/types.h"
#include "src/handles/handles-inl.h"
#include "src/objects/feedback-cell.h"
#include "src/objects/map.h"
#include "src/objects/name.h"
#include "src/objects/objects-inl.h"
namespace v8 {
namespace internal {
namespace compiler {
size_t hash_value(BaseTaggedness base_taggedness) {
return static_cast<uint8_t>(base_taggedness);
}
std::ostream& operator<<(std::ostream& os, BaseTaggedness base_taggedness) {
switch (base_taggedness) {
case kUntaggedBase:
return os << "untagged base";
case kTaggedBase:
return os << "tagged base";
}
UNREACHABLE();
}
std::ostream& operator<<(std::ostream& os,
ConstFieldInfo const& const_field_info) {
if (const_field_info.IsConst()) {
return os << "const (field owner: " << const_field_info.owner_map.address()
<< ")";
} else {
return os << "mutable";
}
UNREACHABLE();
}
bool operator==(ConstFieldInfo const& lhs, ConstFieldInfo const& rhs) {
return lhs.owner_map.address() == rhs.owner_map.address();
}
size_t hash_value(ConstFieldInfo const& const_field_info) {
return static_cast<size_t>(const_field_info.owner_map.address());
}
bool operator==(FieldAccess const& lhs, FieldAccess const& rhs) {
// On purpose we don't include the write barrier kind here, as this method is
// really only relevant for eliminating loads and they don't care about the
// write barrier mode.
return lhs.base_is_tagged == rhs.base_is_tagged && lhs.offset == rhs.offset &&
lhs.map.address() == rhs.map.address() &&
lhs.machine_type == rhs.machine_type &&
lhs.const_field_info == rhs.const_field_info &&
lhs.is_store_in_literal == rhs.is_store_in_literal;
}
size_t hash_value(FieldAccess const& access) {
// On purpose we don't include the write barrier kind here, as this method is
// really only relevant for eliminating loads and they don't care about the
// write barrier mode.
return base::hash_combine(access.base_is_tagged, access.offset,
access.machine_type, access.const_field_info,
access.is_store_in_literal);
}
size_t hash_value(LoadSensitivity load_sensitivity) {
return static_cast<size_t>(load_sensitivity);
}
std::ostream& operator<<(std::ostream& os, LoadSensitivity load_sensitivity) {
switch (load_sensitivity) {
case LoadSensitivity::kCritical:
return os << "Critical";
case LoadSensitivity::kSafe:
return os << "Safe";
case LoadSensitivity::kUnsafe:
return os << "Unsafe";
}
UNREACHABLE();
}
std::ostream& operator<<(std::ostream& os, FieldAccess const& access) {
os << "[" << access.base_is_tagged << ", " << access.offset << ", ";
#ifdef OBJECT_PRINT
Handle<Name> name;
if (access.name.ToHandle(&name)) {
name->NamePrint(os);
os << ", ";
}
Handle<Map> map;
if (access.map.ToHandle(&map)) {
os << Brief(*map) << ", ";
}
#endif
os << access.type << ", " << access.machine_type << ", "
<< access.write_barrier_kind << ", " << access.const_field_info;
if (access.is_store_in_literal) {
os << " (store in literal)";
}
if (FLAG_untrusted_code_mitigations) {
os << ", " << access.load_sensitivity;
}
os << "]";
return os;
}
template <>
void Operator1<FieldAccess>::PrintParameter(std::ostream& os,
PrintVerbosity verbose) const {
if (verbose == PrintVerbosity::kVerbose) {
os << parameter();
} else {
os << "[+" << parameter().offset << "]";
}
}
bool operator==(ElementAccess const& lhs, ElementAccess const& rhs) {
// On purpose we don't include the write barrier kind here, as this method is
// really only relevant for eliminating loads and they don't care about the
// write barrier mode.
return lhs.base_is_tagged == rhs.base_is_tagged &&
lhs.header_size == rhs.header_size &&
lhs.machine_type == rhs.machine_type;
}
size_t hash_value(ElementAccess const& access) {
// On purpose we don't include the write barrier kind here, as this method is
// really only relevant for eliminating loads and they don't care about the
// write barrier mode.
return base::hash_combine(access.base_is_tagged, access.header_size,
access.machine_type);
}
std::ostream& operator<<(std::ostream& os, ElementAccess const& access) {
os << access.base_is_tagged << ", " << access.header_size << ", "
<< access.type << ", " << access.machine_type << ", "
<< access.write_barrier_kind;
if (FLAG_untrusted_code_mitigations) {
os << ", " << access.load_sensitivity;
}
return os;
}
bool operator==(ObjectAccess const& lhs, ObjectAccess const& rhs) {
return lhs.machine_type == rhs.machine_type &&
lhs.write_barrier_kind == rhs.write_barrier_kind;
}
size_t hash_value(ObjectAccess const& access) {
return base::hash_combine(access.machine_type, access.write_barrier_kind);
}
std::ostream& operator<<(std::ostream& os, ObjectAccess const& access) {
os << access.machine_type << ", " << access.write_barrier_kind;
return os;
}
const FieldAccess& FieldAccessOf(const Operator* op) {
DCHECK_NOT_NULL(op);
DCHECK(op->opcode() == IrOpcode::kLoadField ||
op->opcode() == IrOpcode::kStoreField);
return OpParameter<FieldAccess>(op);
}
const ElementAccess& ElementAccessOf(const Operator* op) {
DCHECK_NOT_NULL(op);
DCHECK(op->opcode() == IrOpcode::kLoadElement ||
op->opcode() == IrOpcode::kStoreElement);
return OpParameter<ElementAccess>(op);
}
const ObjectAccess& ObjectAccessOf(const Operator* op) {
DCHECK_NOT_NULL(op);
DCHECK(op->opcode() == IrOpcode::kLoadFromObject ||
op->opcode() == IrOpcode::kStoreToObject);
return OpParameter<ObjectAccess>(op);
}
ExternalArrayType ExternalArrayTypeOf(const Operator* op) {
DCHECK(op->opcode() == IrOpcode::kLoadTypedElement ||
op->opcode() == IrOpcode::kLoadDataViewElement ||
op->opcode() == IrOpcode::kStoreTypedElement ||
op->opcode() == IrOpcode::kStoreDataViewElement);
return OpParameter<ExternalArrayType>(op);
}
ConvertReceiverMode ConvertReceiverModeOf(Operator const* op) {
DCHECK_EQ(IrOpcode::kConvertReceiver, op->opcode());
return OpParameter<ConvertReceiverMode>(op);
}
size_t hash_value(CheckFloat64HoleMode mode) {
return static_cast<size_t>(mode);
}
std::ostream& operator<<(std::ostream& os, CheckFloat64HoleMode mode) {
switch (mode) {
case CheckFloat64HoleMode::kAllowReturnHole:
return os << "allow-return-hole";
case CheckFloat64HoleMode::kNeverReturnHole:
return os << "never-return-hole";
}
UNREACHABLE();
}
CheckFloat64HoleParameters const& CheckFloat64HoleParametersOf(
Operator const* op) {
DCHECK_EQ(IrOpcode::kCheckFloat64Hole, op->opcode());
return OpParameter<CheckFloat64HoleParameters>(op);
}
std::ostream& operator<<(std::ostream& os,
CheckFloat64HoleParameters const& params) {
return os << params.mode() << ", " << params.feedback();
}
size_t hash_value(const CheckFloat64HoleParameters& params) {
FeedbackSource::Hash feedback_hash;
return base::hash_combine(params.mode(), feedback_hash(params.feedback()));
}
bool operator==(CheckFloat64HoleParameters const& lhs,
CheckFloat64HoleParameters const& rhs) {
return lhs.mode() == rhs.mode() && lhs.feedback() == rhs.feedback();
}
bool operator!=(CheckFloat64HoleParameters const& lhs,
CheckFloat64HoleParameters const& rhs) {
return !(lhs == rhs);
}
CheckForMinusZeroMode CheckMinusZeroModeOf(const Operator* op) {
DCHECK(op->opcode() == IrOpcode::kChangeFloat64ToTagged ||
op->opcode() == IrOpcode::kCheckedInt32Mul);
return OpParameter<CheckForMinusZeroMode>(op);
}
size_t hash_value(CheckForMinusZeroMode mode) {
return static_cast<size_t>(mode);
}
std::ostream& operator<<(std::ostream& os, CheckForMinusZeroMode mode) {
switch (mode) {
case CheckForMinusZeroMode::kCheckForMinusZero:
return os << "check-for-minus-zero";
case CheckForMinusZeroMode::kDontCheckForMinusZero:
return os << "dont-check-for-minus-zero";
}
UNREACHABLE();
}
std::ostream& operator<<(std::ostream& os, CheckMapsFlags flags) {
if (flags & CheckMapsFlag::kTryMigrateInstance) {
return os << "TryMigrateInstance";
} else {
return os << "None";
}
}
bool operator==(CheckMapsParameters const& lhs,
CheckMapsParameters const& rhs) {
return lhs.flags() == rhs.flags() && lhs.maps() == rhs.maps() &&
lhs.feedback() == rhs.feedback();
}
size_t hash_value(CheckMapsParameters const& p) {
FeedbackSource::Hash feedback_hash;
return base::hash_combine(p.flags(), p.maps(), feedback_hash(p.feedback()));
}
std::ostream& operator<<(std::ostream& os, CheckMapsParameters const& p) {
return os << p.flags() << ", " << p.maps() << ", " << p.feedback();
}
CheckMapsParameters const& CheckMapsParametersOf(Operator const* op) {
DCHECK_EQ(IrOpcode::kCheckMaps, op->opcode());
return OpParameter<CheckMapsParameters>(op);
}
ZoneHandleSet<Map> const& CompareMapsParametersOf(Operator const* op) {
DCHECK_EQ(IrOpcode::kCompareMaps, op->opcode());
return OpParameter<ZoneHandleSet<Map>>(op);
}
ZoneHandleSet<Map> const& MapGuardMapsOf(Operator const* op) {
DCHECK_EQ(IrOpcode::kMapGuard, op->opcode());
return OpParameter<ZoneHandleSet<Map>>(op);
}
size_t hash_value(CheckTaggedInputMode mode) {
return static_cast<size_t>(mode);
}
std::ostream& operator<<(std::ostream& os, CheckTaggedInputMode mode) {
switch (mode) {
case CheckTaggedInputMode::kNumber:
return os << "Number";
case CheckTaggedInputMode::kNumberOrBoolean:
return os << "NumberOrBoolean";
case CheckTaggedInputMode::kNumberOrOddball:
return os << "NumberOrOddball";
}
UNREACHABLE();
}
std::ostream& operator<<(std::ostream& os, GrowFastElementsMode mode) {
switch (mode) {
case GrowFastElementsMode::kDoubleElements:
return os << "DoubleElements";
case GrowFastElementsMode::kSmiOrObjectElements:
return os << "SmiOrObjectElements";
}
UNREACHABLE();
}
bool operator==(const GrowFastElementsParameters& lhs,
const GrowFastElementsParameters& rhs) {
return lhs.mode() == rhs.mode() && lhs.feedback() == rhs.feedback();
}
inline size_t hash_value(const GrowFastElementsParameters& params) {
FeedbackSource::Hash feedback_hash;
return base::hash_combine(params.mode(), feedback_hash(params.feedback()));
}
std::ostream& operator<<(std::ostream& os,
const GrowFastElementsParameters& params) {
return os << params.mode() << ", " << params.feedback();
}
const GrowFastElementsParameters& GrowFastElementsParametersOf(
const Operator* op) {
DCHECK_EQ(IrOpcode::kMaybeGrowFastElements, op->opcode());
return OpParameter<GrowFastElementsParameters>(op);
}
bool operator==(ElementsTransition const& lhs, ElementsTransition const& rhs) {
return lhs.mode() == rhs.mode() &&
lhs.source().address() == rhs.source().address() &&
lhs.target().address() == rhs.target().address();
}
size_t hash_value(ElementsTransition transition) {
return base::hash_combine(static_cast<uint8_t>(transition.mode()),
transition.source().address(),
transition.target().address());
}
std::ostream& operator<<(std::ostream& os, ElementsTransition transition) {
switch (transition.mode()) {
case ElementsTransition::kFastTransition:
return os << "fast-transition from " << Brief(*transition.source())
<< " to " << Brief(*transition.target());
case ElementsTransition::kSlowTransition:
return os << "slow-transition from " << Brief(*transition.source())
<< " to " << Brief(*transition.target());
}
UNREACHABLE();
}
ElementsTransition const& ElementsTransitionOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kTransitionElementsKind, op->opcode());
return OpParameter<ElementsTransition>(op);
}
namespace {
// Parameters for the TransitionAndStoreElement opcode.
class TransitionAndStoreElementParameters final {
public:
TransitionAndStoreElementParameters(Handle<Map> double_map,
Handle<Map> fast_map);
Handle<Map> double_map() const { return double_map_; }
Handle<Map> fast_map() const { return fast_map_; }
private:
Handle<Map> const double_map_;
Handle<Map> const fast_map_;
};
TransitionAndStoreElementParameters::TransitionAndStoreElementParameters(
Handle<Map> double_map, Handle<Map> fast_map)
: double_map_(double_map), fast_map_(fast_map) {}
bool operator==(TransitionAndStoreElementParameters const& lhs,
TransitionAndStoreElementParameters const& rhs) {
return lhs.fast_map().address() == rhs.fast_map().address() &&
lhs.double_map().address() == rhs.double_map().address();
}
size_t hash_value(TransitionAndStoreElementParameters parameters) {
return base::hash_combine(parameters.fast_map().address(),
parameters.double_map().address());
}
std::ostream& operator<<(std::ostream& os,
TransitionAndStoreElementParameters parameters) {
return os << "fast-map" << Brief(*parameters.fast_map()) << " double-map"
<< Brief(*parameters.double_map());
}
} // namespace
namespace {
// Parameters for the TransitionAndStoreNonNumberElement opcode.
class TransitionAndStoreNonNumberElementParameters final {
public:
TransitionAndStoreNonNumberElementParameters(Handle<Map> fast_map,
Type value_type);
Handle<Map> fast_map() const { return fast_map_; }
Type value_type() const { return value_type_; }
private:
Handle<Map> const fast_map_;
Type value_type_;
};
TransitionAndStoreNonNumberElementParameters::
TransitionAndStoreNonNumberElementParameters(Handle<Map> fast_map,
Type value_type)
: fast_map_(fast_map), value_type_(value_type) {}
bool operator==(TransitionAndStoreNonNumberElementParameters const& lhs,
TransitionAndStoreNonNumberElementParameters const& rhs) {
return lhs.fast_map().address() == rhs.fast_map().address() &&
lhs.value_type() == rhs.value_type();
}
size_t hash_value(TransitionAndStoreNonNumberElementParameters parameters) {
return base::hash_combine(parameters.fast_map().address(),
parameters.value_type());
}
std::ostream& operator<<(
std::ostream& os, TransitionAndStoreNonNumberElementParameters parameters) {
return os << parameters.value_type() << ", fast-map"
<< Brief(*parameters.fast_map());
}
} // namespace
namespace {
// Parameters for the TransitionAndStoreNumberElement opcode.
class TransitionAndStoreNumberElementParameters final {
public:
explicit TransitionAndStoreNumberElementParameters(Handle<Map> double_map);
Handle<Map> double_map() const { return double_map_; }
private:
Handle<Map> const double_map_;
};
TransitionAndStoreNumberElementParameters::
TransitionAndStoreNumberElementParameters(Handle<Map> double_map)
: double_map_(double_map) {}
bool operator==(TransitionAndStoreNumberElementParameters const& lhs,
TransitionAndStoreNumberElementParameters const& rhs) {
return lhs.double_map().address() == rhs.double_map().address();
}
size_t hash_value(TransitionAndStoreNumberElementParameters parameters) {
return base::hash_combine(parameters.double_map().address());
}
std::ostream& operator<<(std::ostream& os,
TransitionAndStoreNumberElementParameters parameters) {
return os << "double-map" << Brief(*parameters.double_map());
}
} // namespace
Handle<Map> DoubleMapParameterOf(const Operator* op) {
if (op->opcode() == IrOpcode::kTransitionAndStoreElement) {
return OpParameter<TransitionAndStoreElementParameters>(op).double_map();
} else if (op->opcode() == IrOpcode::kTransitionAndStoreNumberElement) {
return OpParameter<TransitionAndStoreNumberElementParameters>(op)
.double_map();
}
UNREACHABLE();
return Handle<Map>::null();
}
Type ValueTypeParameterOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kTransitionAndStoreNonNumberElement, op->opcode());
return OpParameter<TransitionAndStoreNonNumberElementParameters>(op)
.value_type();
}
Handle<Map> FastMapParameterOf(const Operator* op) {
if (op->opcode() == IrOpcode::kTransitionAndStoreElement) {
return OpParameter<TransitionAndStoreElementParameters>(op).fast_map();
} else if (op->opcode() == IrOpcode::kTransitionAndStoreNonNumberElement) {
return OpParameter<TransitionAndStoreNonNumberElementParameters>(op)
.fast_map();
}
UNREACHABLE();
return Handle<Map>::null();
}
std::ostream& operator<<(std::ostream& os, BigIntOperationHint hint) {
switch (hint) {
case BigIntOperationHint::kBigInt:
return os << "BigInt";
}
UNREACHABLE();
}
size_t hash_value(BigIntOperationHint hint) {
return static_cast<uint8_t>(hint);
}
std::ostream& operator<<(std::ostream& os, NumberOperationHint hint) {
switch (hint) {
case NumberOperationHint::kSignedSmall:
return os << "SignedSmall";
case NumberOperationHint::kSignedSmallInputs:
return os << "SignedSmallInputs";
case NumberOperationHint::kSigned32:
return os << "Signed32";
case NumberOperationHint::kNumber:
return os << "Number";
case NumberOperationHint::kNumberOrBoolean:
return os << "NumberOrBoolean";
case NumberOperationHint::kNumberOrOddball:
return os << "NumberOrOddball";
}
UNREACHABLE();
}
size_t hash_value(NumberOperationHint hint) {
return static_cast<uint8_t>(hint);
}
NumberOperationHint NumberOperationHintOf(const Operator* op) {
DCHECK(op->opcode() == IrOpcode::kSpeculativeNumberAdd ||
op->opcode() == IrOpcode::kSpeculativeNumberSubtract ||
op->opcode() == IrOpcode::kSpeculativeNumberMultiply ||
op->opcode() == IrOpcode::kSpeculativeNumberDivide ||
op->opcode() == IrOpcode::kSpeculativeNumberModulus ||
op->opcode() == IrOpcode::kSpeculativeNumberShiftLeft ||
op->opcode() == IrOpcode::kSpeculativeNumberShiftRight ||
op->opcode() == IrOpcode::kSpeculativeNumberShiftRightLogical ||
op->opcode() == IrOpcode::kSpeculativeNumberBitwiseAnd ||
op->opcode() == IrOpcode::kSpeculativeNumberBitwiseOr ||
op->opcode() == IrOpcode::kSpeculativeNumberBitwiseXor ||
op->opcode() == IrOpcode::kSpeculativeNumberEqual ||
op->opcode() == IrOpcode::kSpeculativeNumberLessThan ||
op->opcode() == IrOpcode::kSpeculativeNumberLessThanOrEqual ||
op->opcode() == IrOpcode::kSpeculativeSafeIntegerAdd ||
op->opcode() == IrOpcode::kSpeculativeSafeIntegerSubtract);
return OpParameter<NumberOperationHint>(op);
}
bool operator==(NumberOperationParameters const& lhs,
NumberOperationParameters const& rhs) {
return lhs.hint() == rhs.hint() && lhs.feedback() == rhs.feedback();
}
size_t hash_value(NumberOperationParameters const& p) {
FeedbackSource::Hash feedback_hash;
return base::hash_combine(p.hint(), feedback_hash(p.feedback()));
}
std::ostream& operator<<(std::ostream& os, NumberOperationParameters const& p) {
return os << p.hint() << ", " << p.feedback();
}
NumberOperationParameters const& NumberOperationParametersOf(
Operator const* op) {
DCHECK_EQ(IrOpcode::kSpeculativeToNumber, op->opcode());
return OpParameter<NumberOperationParameters>(op);
}
size_t hash_value(AllocateParameters info) {
return base::hash_combine(info.type(),
static_cast<int>(info.allocation_type()));
}
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
AllocateParameters info) {
return os << info.type() << ", " << info.allocation_type();
}
bool operator==(AllocateParameters const& lhs, AllocateParameters const& rhs) {
return lhs.allocation_type() == rhs.allocation_type() &&
lhs.type() == rhs.type();
}
const AllocateParameters& AllocateParametersOf(const Operator* op) {
DCHECK(op->opcode() == IrOpcode::kAllocate ||
op->opcode() == IrOpcode::kAllocateRaw);
return OpParameter<AllocateParameters>(op);
}
AllocationType AllocationTypeOf(const Operator* op) {
if (op->opcode() == IrOpcode::kNewDoubleElements ||
op->opcode() == IrOpcode::kNewSmiOrObjectElements) {
return OpParameter<AllocationType>(op);
}
return AllocateParametersOf(op).allocation_type();
}
Type AllocateTypeOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kAllocate, op->opcode());
return AllocateParametersOf(op).type();
}
AbortReason AbortReasonOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kRuntimeAbort, op->opcode());
return static_cast<AbortReason>(OpParameter<int>(op));
}
const CheckTaggedInputParameters& CheckTaggedInputParametersOf(
const Operator* op) {
DCHECK(op->opcode() == IrOpcode::kCheckedTruncateTaggedToWord32 ||
op->opcode() == IrOpcode::kCheckedTaggedToFloat64);
return OpParameter<CheckTaggedInputParameters>(op);
}
std::ostream& operator<<(std::ostream& os,
const CheckTaggedInputParameters& params) {
return os << params.mode() << ", " << params.feedback();
}
size_t hash_value(const CheckTaggedInputParameters& params) {
FeedbackSource::Hash feedback_hash;
return base::hash_combine(params.mode(), feedback_hash(params.feedback()));
}
bool operator==(CheckTaggedInputParameters const& lhs,
CheckTaggedInputParameters const& rhs) {
return lhs.mode() == rhs.mode() && lhs.feedback() == rhs.feedback();
}
const CheckMinusZeroParameters& CheckMinusZeroParametersOf(const Operator* op) {
DCHECK(op->opcode() == IrOpcode::kCheckedTaggedToInt32 ||
op->opcode() == IrOpcode::kCheckedTaggedToInt64 ||
op->opcode() == IrOpcode::kCheckedFloat64ToInt32 ||
op->opcode() == IrOpcode::kCheckedFloat64ToInt64);
return OpParameter<CheckMinusZeroParameters>(op);
}
std::ostream& operator<<(std::ostream& os,
const CheckMinusZeroParameters& params) {
return os << params.mode() << ", " << params.feedback();
}
size_t hash_value(const CheckMinusZeroParameters& params) {
FeedbackSource::Hash feedback_hash;
return base::hash_combine(params.mode(), feedback_hash(params.feedback()));
}
bool operator==(CheckMinusZeroParameters const& lhs,
CheckMinusZeroParameters const& rhs) {
return lhs.mode() == rhs.mode() && lhs.feedback() == rhs.feedback();
}
#define PURE_OP_LIST(V) \
V(BooleanNot, Operator::kNoProperties, 1, 0) \
V(NumberEqual, Operator::kCommutative, 2, 0) \
V(NumberLessThan, Operator::kNoProperties, 2, 0) \
V(NumberLessThanOrEqual, Operator::kNoProperties, 2, 0) \
V(NumberAdd, Operator::kCommutative, 2, 0) \
V(NumberSubtract, Operator::kNoProperties, 2, 0) \
V(NumberMultiply, Operator::kCommutative, 2, 0) \
V(NumberDivide, Operator::kNoProperties, 2, 0) \
V(NumberModulus, Operator::kNoProperties, 2, 0) \
V(NumberBitwiseOr, Operator::kCommutative, 2, 0) \
V(NumberBitwiseXor, Operator::kCommutative, 2, 0) \
V(NumberBitwiseAnd, Operator::kCommutative, 2, 0) \
V(NumberShiftLeft, Operator::kNoProperties, 2, 0) \
V(NumberShiftRight, Operator::kNoProperties, 2, 0) \
V(NumberShiftRightLogical, Operator::kNoProperties, 2, 0) \
V(NumberImul, Operator::kCommutative, 2, 0) \
V(NumberAbs, Operator::kNoProperties, 1, 0) \
V(NumberClz32, Operator::kNoProperties, 1, 0) \
V(NumberCeil, Operator::kNoProperties, 1, 0) \
V(NumberFloor, Operator::kNoProperties, 1, 0) \
V(NumberFround, Operator::kNoProperties, 1, 0) \
V(NumberAcos, Operator::kNoProperties, 1, 0) \
V(NumberAcosh, Operator::kNoProperties, 1, 0) \
V(NumberAsin, Operator::kNoProperties, 1, 0) \
V(NumberAsinh, Operator::kNoProperties, 1, 0) \
V(NumberAtan, Operator::kNoProperties, 1, 0) \
V(NumberAtan2, Operator::kNoProperties, 2, 0) \
V(NumberAtanh, Operator::kNoProperties, 1, 0) \
V(NumberCbrt, Operator::kNoProperties, 1, 0) \
V(NumberCos, Operator::kNoProperties, 1, 0) \
V(NumberCosh, Operator::kNoProperties, 1, 0) \
V(NumberExp, Operator::kNoProperties, 1, 0) \
V(NumberExpm1, Operator::kNoProperties, 1, 0) \
V(NumberLog, Operator::kNoProperties, 1, 0) \
V(NumberLog1p, Operator::kNoProperties, 1, 0) \
V(NumberLog10, Operator::kNoProperties, 1, 0) \
V(NumberLog2, Operator::kNoProperties, 1, 0) \
V(NumberMax, Operator::kNoProperties, 2, 0) \
V(NumberMin, Operator::kNoProperties, 2, 0) \
V(NumberPow, Operator::kNoProperties, 2, 0) \
V(NumberRound, Operator::kNoProperties, 1, 0) \
V(NumberSign, Operator::kNoProperties, 1, 0) \
V(NumberSin, Operator::kNoProperties, 1, 0) \
V(NumberSinh, Operator::kNoProperties, 1, 0) \
V(NumberSqrt, Operator::kNoProperties, 1, 0) \
V(NumberTan, Operator::kNoProperties, 1, 0) \
V(NumberTanh, Operator::kNoProperties, 1, 0) \
V(NumberTrunc, Operator::kNoProperties, 1, 0) \
V(NumberToBoolean, Operator::kNoProperties, 1, 0) \
V(NumberToInt32, Operator::kNoProperties, 1, 0) \
V(NumberToString, Operator::kNoProperties, 1, 0) \
V(NumberToUint32, Operator::kNoProperties, 1, 0) \
V(NumberToUint8Clamped, Operator::kNoProperties, 1, 0) \
V(NumberSilenceNaN, Operator::kNoProperties, 1, 0) \
V(BigIntNegate, Operator::kNoProperties, 1, 0) \
V(StringConcat, Operator::kNoProperties, 3, 0) \
V(StringToNumber, Operator::kNoProperties, 1, 0) \
V(StringFromSingleCharCode, Operator::kNoProperties, 1, 0) \
V(StringFromSingleCodePoint, Operator::kNoProperties, 1, 0) \
V(StringIndexOf, Operator::kNoProperties, 3, 0) \
V(StringLength, Operator::kNoProperties, 1, 0) \
V(StringToLowerCaseIntl, Operator::kNoProperties, 1, 0) \
V(StringToUpperCaseIntl, Operator::kNoProperties, 1, 0) \
V(TypeOf, Operator::kNoProperties, 1, 1) \
V(PlainPrimitiveToNumber, Operator::kNoProperties, 1, 0) \
V(PlainPrimitiveToWord32, Operator::kNoProperties, 1, 0) \
V(PlainPrimitiveToFloat64, Operator::kNoProperties, 1, 0) \
V(ChangeTaggedSignedToInt32, Operator::kNoProperties, 1, 0) \
V(ChangeTaggedSignedToInt64, Operator::kNoProperties, 1, 0) \
V(ChangeTaggedToInt32, Operator::kNoProperties, 1, 0) \
V(ChangeTaggedToInt64, Operator::kNoProperties, 1, 0) \
V(ChangeTaggedToUint32, Operator::kNoProperties, 1, 0) \
V(ChangeTaggedToFloat64, Operator::kNoProperties, 1, 0) \
V(ChangeTaggedToTaggedSigned, Operator::kNoProperties, 1, 0) \
V(ChangeFloat64ToTaggedPointer, Operator::kNoProperties, 1, 0) \
V(ChangeInt31ToTaggedSigned, Operator::kNoProperties, 1, 0) \
V(ChangeInt32ToTagged, Operator::kNoProperties, 1, 0) \
V(ChangeInt64ToTagged, Operator::kNoProperties, 1, 0) \
V(ChangeUint32ToTagged, Operator::kNoProperties, 1, 0) \
V(ChangeUint64ToTagged, Operator::kNoProperties, 1, 0) \
V(ChangeTaggedToBit, Operator::kNoProperties, 1, 0) \
V(ChangeBitToTagged, Operator::kNoProperties, 1, 0) \
V(TruncateBigIntToUint64, Operator::kNoProperties, 1, 0) \
V(ChangeUint64ToBigInt, Operator::kNoProperties, 1, 0) \
V(TruncateTaggedToBit, Operator::kNoProperties, 1, 0) \
V(TruncateTaggedPointerToBit, Operator::kNoProperties, 1, 0) \
V(TruncateTaggedToWord32, Operator::kNoProperties, 1, 0) \
V(TruncateTaggedToFloat64, Operator::kNoProperties, 1, 0) \
V(ObjectIsArrayBufferView, Operator::kNoProperties, 1, 0) \
V(ObjectIsBigInt, Operator::kNoProperties, 1, 0) \
V(ObjectIsCallable, Operator::kNoProperties, 1, 0) \
V(ObjectIsConstructor, Operator::kNoProperties, 1, 0) \
V(ObjectIsDetectableCallable, Operator::kNoProperties, 1, 0) \
V(ObjectIsMinusZero, Operator::kNoProperties, 1, 0) \
V(NumberIsMinusZero, Operator::kNoProperties, 1, 0) \
V(ObjectIsNaN, Operator::kNoProperties, 1, 0) \
V(NumberIsNaN, Operator::kNoProperties, 1, 0) \
V(ObjectIsNonCallable, Operator::kNoProperties, 1, 0) \
V(ObjectIsNumber, Operator::kNoProperties, 1, 0) \
V(ObjectIsReceiver, Operator::kNoProperties, 1, 0) \
V(ObjectIsSmi, Operator::kNoProperties, 1, 0) \
V(ObjectIsString, Operator::kNoProperties, 1, 0) \
V(ObjectIsSymbol, Operator::kNoProperties, 1, 0) \
V(ObjectIsUndetectable, Operator::kNoProperties, 1, 0) \
V(NumberIsFloat64Hole, Operator::kNoProperties, 1, 0) \
V(NumberIsFinite, Operator::kNoProperties, 1, 0) \
V(ObjectIsFiniteNumber, Operator::kNoProperties, 1, 0) \
V(NumberIsInteger, Operator::kNoProperties, 1, 0) \
V(ObjectIsSafeInteger, Operator::kNoProperties, 1, 0) \
V(NumberIsSafeInteger, Operator::kNoProperties, 1, 0) \
V(ObjectIsInteger, Operator::kNoProperties, 1, 0) \
V(ConvertTaggedHoleToUndefined, Operator::kNoProperties, 1, 0) \
V(SameValue, Operator::kCommutative, 2, 0) \
V(SameValueNumbersOnly, Operator::kCommutative, 2, 0) \
V(NumberSameValue, Operator::kCommutative, 2, 0) \
V(ReferenceEqual, Operator::kCommutative, 2, 0) \
V(StringEqual, Operator::kCommutative, 2, 0) \
V(StringLessThan, Operator::kNoProperties, 2, 0) \
V(StringLessThanOrEqual, Operator::kNoProperties, 2, 0) \
V(ToBoolean, Operator::kNoProperties, 1, 0) \
V(NewConsString, Operator::kNoProperties, 3, 0) \
V(PoisonIndex, Operator::kNoProperties, 1, 0)
#define EFFECT_DEPENDENT_OP_LIST(V) \
V(BigIntAdd, Operator::kNoProperties, 2, 1) \
V(BigIntSubtract, Operator::kNoProperties, 2, 1) \
V(StringCharCodeAt, Operator::kNoProperties, 2, 1) \
V(StringCodePointAt, Operator::kNoProperties, 2, 1) \
V(StringFromCodePointAt, Operator::kNoProperties, 2, 1) \
V(StringSubstring, Operator::kNoProperties, 3, 1) \
V(DateNow, Operator::kNoProperties, 0, 1)
#define SPECULATIVE_NUMBER_BINOP_LIST(V) \
SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(V) \
V(SpeculativeNumberEqual) \
V(SpeculativeNumberLessThan) \
V(SpeculativeNumberLessThanOrEqual)
#define CHECKED_OP_LIST(V) \
V(CheckEqualsInternalizedString, 2, 0) \
V(CheckEqualsSymbol, 2, 0) \
V(CheckHeapObject, 1, 1) \
V(CheckInternalizedString, 1, 1) \
V(CheckNotTaggedHole, 1, 1) \
V(CheckReceiver, 1, 1) \
V(CheckReceiverOrNullOrUndefined, 1, 1) \
V(CheckSymbol, 1, 1) \
V(CheckedInt32Add, 2, 1) \
V(CheckedInt32Div, 2, 1) \
V(CheckedInt32Mod, 2, 1) \
V(CheckedInt32Sub, 2, 1) \
V(CheckedUint32Div, 2, 1) \
V(CheckedUint32Mod, 2, 1)
#define CHECKED_WITH_FEEDBACK_OP_LIST(V) \
V(CheckNumber, 1, 1) \
V(CheckSmi, 1, 1) \
V(CheckString, 1, 1) \
V(CheckBigInt, 1, 1) \
V(CheckedInt32ToTaggedSigned, 1, 1) \
V(CheckedInt64ToInt32, 1, 1) \
V(CheckedInt64ToTaggedSigned, 1, 1) \
V(CheckedTaggedToArrayIndex, 1, 1) \
V(CheckedTaggedSignedToInt32, 1, 1) \
V(CheckedTaggedToTaggedPointer, 1, 1) \
V(CheckedTaggedToTaggedSigned, 1, 1) \
V(CheckedUint32ToInt32, 1, 1) \
V(CheckedUint32ToTaggedSigned, 1, 1) \
V(CheckedUint64ToInt32, 1, 1) \
V(CheckedUint64ToTaggedSigned, 1, 1)
#define CHECKED_BOUNDS_OP_LIST(V) \
V(CheckedUint32Bounds) \
V(CheckedUint64Bounds)
struct SimplifiedOperatorGlobalCache final {
#define PURE(Name, properties, value_input_count, control_input_count) \
struct Name##Operator final : public Operator { \
Name##Operator() \
: Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \
value_input_count, 0, control_input_count, 1, 0, 0) {} \
}; \
Name##Operator k##Name;
PURE_OP_LIST(PURE)
#undef PURE
#define EFFECT_DEPENDENT(Name, properties, value_input_count, \
control_input_count) \
struct Name##Operator final : public Operator { \
Name##Operator() \
: Operator(IrOpcode::k##Name, Operator::kEliminatable | properties, \
#Name, value_input_count, 1, control_input_count, 1, 1, \
0) {} \
}; \
Name##Operator k##Name;
EFFECT_DEPENDENT_OP_LIST(EFFECT_DEPENDENT)
#undef EFFECT_DEPENDENT
#define CHECKED(Name, value_input_count, value_output_count) \
struct Name##Operator final : public Operator { \
Name##Operator() \
: Operator(IrOpcode::k##Name, \
Operator::kFoldable | Operator::kNoThrow, #Name, \
value_input_count, 1, 1, value_output_count, 1, 0) {} \
}; \
Name##Operator k##Name;
CHECKED_OP_LIST(CHECKED)
#undef CHECKED
#define CHECKED_WITH_FEEDBACK(Name, value_input_count, value_output_count) \
struct Name##Operator final : public Operator1<CheckParameters> { \
Name##Operator() \
: Operator1<CheckParameters>( \
IrOpcode::k##Name, Operator::kFoldable | Operator::kNoThrow, \
#Name, value_input_count, 1, 1, value_output_count, 1, 0, \
CheckParameters(FeedbackSource())) {} \
}; \
Name##Operator k##Name;
CHECKED_WITH_FEEDBACK_OP_LIST(CHECKED_WITH_FEEDBACK)
#undef CHECKED_WITH_FEEDBACK
#define CHECKED_BOUNDS(Name) \
struct Name##Operator final : public Operator1<CheckBoundsParameters> { \
Name##Operator(FeedbackSource feedback, CheckBoundsFlags flags) \
: Operator1<CheckBoundsParameters>( \
IrOpcode::k##Name, Operator::kFoldable | Operator::kNoThrow, \
#Name, 2, 1, 1, 1, 1, 0, \
CheckBoundsParameters(feedback, flags)) {} \
}; \
Name##Operator k##Name = {FeedbackSource(), CheckBoundsFlags()}; \
Name##Operator k##Name##Aborting = {FeedbackSource(), \
CheckBoundsFlag::kAbortOnOutOfBounds};
CHECKED_BOUNDS_OP_LIST(CHECKED_BOUNDS)
CHECKED_BOUNDS(CheckBounds)
// For IrOpcode::kCheckBounds, we allow additional flags:
CheckBoundsOperator kCheckBoundsConverting = {
FeedbackSource(), CheckBoundsFlag::kConvertStringAndMinusZero};
CheckBoundsOperator kCheckBoundsAbortingAndConverting = {
FeedbackSource(),
CheckBoundsFlags(CheckBoundsFlag::kAbortOnOutOfBounds) |
CheckBoundsFlags(CheckBoundsFlag::kConvertStringAndMinusZero)};
#undef CHECKED_BOUNDS
template <DeoptimizeReason kDeoptimizeReason>
struct CheckIfOperator final : public Operator1<CheckIfParameters> {
CheckIfOperator()
: Operator1<CheckIfParameters>(
IrOpcode::kCheckIf, Operator::kFoldable | Operator::kNoThrow,
"CheckIf", 1, 1, 1, 0, 1, 0,
CheckIfParameters(kDeoptimizeReason, FeedbackSource())) {}
};
#define CHECK_IF(Name, message) \
CheckIfOperator<DeoptimizeReason::k##Name> kCheckIf##Name;
DEOPTIMIZE_REASON_LIST(CHECK_IF)
#undef CHECK_IF
struct FindOrderedHashMapEntryOperator final : public Operator {
FindOrderedHashMapEntryOperator()
: Operator(IrOpcode::kFindOrderedHashMapEntry, Operator::kEliminatable,
"FindOrderedHashMapEntry", 2, 1, 1, 1, 1, 0) {}
};
FindOrderedHashMapEntryOperator kFindOrderedHashMapEntry;
struct FindOrderedHashMapEntryForInt32KeyOperator final : public Operator {
FindOrderedHashMapEntryForInt32KeyOperator()
: Operator(IrOpcode::kFindOrderedHashMapEntryForInt32Key,
Operator::kEliminatable,
"FindOrderedHashMapEntryForInt32Key", 2, 1, 1, 1, 1, 0) {}
};
FindOrderedHashMapEntryForInt32KeyOperator
kFindOrderedHashMapEntryForInt32Key;
struct ArgumentsFrameOperator final : public Operator {
ArgumentsFrameOperator()
: Operator(IrOpcode::kArgumentsFrame, Operator::kPure, "ArgumentsFrame",
0, 0, 0, 1, 0, 0) {}
};
ArgumentsFrameOperator kArgumentsFrame;
template <CheckForMinusZeroMode kMode>
struct ChangeFloat64ToTaggedOperator final
: public Operator1<CheckForMinusZeroMode> {
ChangeFloat64ToTaggedOperator()
: Operator1<CheckForMinusZeroMode>(
IrOpcode::kChangeFloat64ToTagged, Operator::kPure,
"ChangeFloat64ToTagged", 1, 0, 0, 1, 0, 0, kMode) {}
};
ChangeFloat64ToTaggedOperator<CheckForMinusZeroMode::kCheckForMinusZero>
kChangeFloat64ToTaggedCheckForMinusZeroOperator;
ChangeFloat64ToTaggedOperator<CheckForMinusZeroMode::kDontCheckForMinusZero>
kChangeFloat64ToTaggedDontCheckForMinusZeroOperator;
template <CheckForMinusZeroMode kMode>
struct CheckedInt32MulOperator final
: public Operator1<CheckForMinusZeroMode> {
CheckedInt32MulOperator()
: Operator1<CheckForMinusZeroMode>(
IrOpcode::kCheckedInt32Mul,
Operator::kFoldable | Operator::kNoThrow, "CheckedInt32Mul", 2, 1,
1, 1, 1, 0, kMode) {}
};
CheckedInt32MulOperator<CheckForMinusZeroMode::kCheckForMinusZero>
kCheckedInt32MulCheckForMinusZeroOperator;
CheckedInt32MulOperator<CheckForMinusZeroMode::kDontCheckForMinusZero>
kCheckedInt32MulDontCheckForMinusZeroOperator;
template <CheckForMinusZeroMode kMode>
struct CheckedFloat64ToInt32Operator final
: public Operator1<CheckMinusZeroParameters> {
CheckedFloat64ToInt32Operator()
: Operator1<CheckMinusZeroParameters>(
IrOpcode::kCheckedFloat64ToInt32,
Operator::kFoldable | Operator::kNoThrow, "CheckedFloat64ToInt32",
1, 1, 1, 1, 1, 0,
CheckMinusZeroParameters(kMode, FeedbackSource())) {}
};
CheckedFloat64ToInt32Operator<CheckForMinusZeroMode::kCheckForMinusZero>
kCheckedFloat64ToInt32CheckForMinusZeroOperator;
CheckedFloat64ToInt32Operator<CheckForMinusZeroMode::kDontCheckForMinusZero>
kCheckedFloat64ToInt32DontCheckForMinusZeroOperator;
template <CheckForMinusZeroMode kMode>
struct CheckedFloat64ToInt64Operator final
: public Operator1<CheckMinusZeroParameters> {
CheckedFloat64ToInt64Operator()
: Operator1<CheckMinusZeroParameters>(
IrOpcode::kCheckedFloat64ToInt64,
Operator::kFoldable | Operator::kNoThrow, "CheckedFloat64ToInt64",
1, 1, 1, 1, 1, 0,
CheckMinusZeroParameters(kMode, FeedbackSource())) {}
};
CheckedFloat64ToInt64Operator<CheckForMinusZeroMode::kCheckForMinusZero>
kCheckedFloat64ToInt64CheckForMinusZeroOperator;
CheckedFloat64ToInt64Operator<CheckForMinusZeroMode::kDontCheckForMinusZero>
kCheckedFloat64ToInt64DontCheckForMinusZeroOperator;
template <CheckForMinusZeroMode kMode>
struct CheckedTaggedToInt32Operator final
: public Operator1<CheckMinusZeroParameters> {
CheckedTaggedToInt32Operator()
: Operator1<CheckMinusZeroParameters>(
IrOpcode::kCheckedTaggedToInt32,
Operator::kFoldable | Operator::kNoThrow, "CheckedTaggedToInt32",
1, 1, 1, 1, 1, 0,
CheckMinusZeroParameters(kMode, FeedbackSource())) {}
};
CheckedTaggedToInt32Operator<CheckForMinusZeroMode::kCheckForMinusZero>
kCheckedTaggedToInt32CheckForMinusZeroOperator;
CheckedTaggedToInt32Operator<CheckForMinusZeroMode::kDontCheckForMinusZero>
kCheckedTaggedToInt32DontCheckForMinusZeroOperator;
template <CheckForMinusZeroMode kMode>
struct CheckedTaggedToInt64Operator final
: public Operator1<CheckMinusZeroParameters> {
CheckedTaggedToInt64Operator()
: Operator1<CheckMinusZeroParameters>(
IrOpcode::kCheckedTaggedToInt64,
Operator::kFoldable | Operator::kNoThrow, "CheckedTaggedToInt64",
1, 1, 1, 1, 1, 0,
CheckMinusZeroParameters(kMode, FeedbackSource())) {}
};
CheckedTaggedToInt64Operator<CheckForMinusZeroMode::kCheckForMinusZero>
kCheckedTaggedToInt64CheckForMinusZeroOperator;
CheckedTaggedToInt64Operator<CheckForMinusZeroMode::kDontCheckForMinusZero>
kCheckedTaggedToInt64DontCheckForMinusZeroOperator;
template <CheckTaggedInputMode kMode>
struct CheckedTaggedToFloat64Operator final
: public Operator1<CheckTaggedInputParameters> {
CheckedTaggedToFloat64Operator()
: Operator1<CheckTaggedInputParameters>(
IrOpcode::kCheckedTaggedToFloat64,
Operator::kFoldable | Operator::kNoThrow,
"CheckedTaggedToFloat64", 1, 1, 1, 1, 1, 0,
CheckTaggedInputParameters(kMode, FeedbackSource())) {}
};
CheckedTaggedToFloat64Operator<CheckTaggedInputMode::kNumber>
kCheckedTaggedToFloat64NumberOperator;
CheckedTaggedToFloat64Operator<CheckTaggedInputMode::kNumberOrBoolean>
kCheckedTaggedToFloat64NumberOrBooleanOperator;
CheckedTaggedToFloat64Operator<CheckTaggedInputMode::kNumberOrOddball>
kCheckedTaggedToFloat64NumberOrOddballOperator;
template <CheckTaggedInputMode kMode>
struct CheckedTruncateTaggedToWord32Operator final
: public Operator1<CheckTaggedInputParameters> {
CheckedTruncateTaggedToWord32Operator()
: Operator1<CheckTaggedInputParameters>(
IrOpcode::kCheckedTruncateTaggedToWord32,
Operator::kFoldable | Operator::kNoThrow,
"CheckedTruncateTaggedToWord32", 1, 1, 1, 1, 1, 0,
CheckTaggedInputParameters(kMode, FeedbackSource())) {}
};
CheckedTruncateTaggedToWord32Operator<CheckTaggedInputMode::kNumber>
kCheckedTruncateTaggedToWord32NumberOperator;
CheckedTruncateTaggedToWord32Operator<CheckTaggedInputMode::kNumberOrOddball>
kCheckedTruncateTaggedToWord32NumberOrOddballOperator;
template <ConvertReceiverMode kMode>
struct ConvertReceiverOperator final : public Operator1<ConvertReceiverMode> {
ConvertReceiverOperator()
: Operator1<ConvertReceiverMode>( // --
IrOpcode::kConvertReceiver, // opcode
Operator::kEliminatable, // flags
"ConvertReceiver", // name
2, 1, 1, 1, 1, 0, // counts
kMode) {} // param
};
ConvertReceiverOperator<ConvertReceiverMode::kAny>
kConvertReceiverAnyOperator;
ConvertReceiverOperator<ConvertReceiverMode::kNullOrUndefined>
kConvertReceiverNullOrUndefinedOperator;
ConvertReceiverOperator<ConvertReceiverMode::kNotNullOrUndefined>
kConvertReceiverNotNullOrUndefinedOperator;
template <CheckFloat64HoleMode kMode>
struct CheckFloat64HoleNaNOperator final
: public Operator1<CheckFloat64HoleParameters> {
CheckFloat64HoleNaNOperator()
: Operator1<CheckFloat64HoleParameters>(
IrOpcode::kCheckFloat64Hole,
Operator::kFoldable | Operator::kNoThrow, "CheckFloat64Hole", 1,
1, 1, 1, 1, 0,
CheckFloat64HoleParameters(kMode, FeedbackSource())) {}
};
CheckFloat64HoleNaNOperator<CheckFloat64HoleMode::kAllowReturnHole>
kCheckFloat64HoleAllowReturnHoleOperator;
CheckFloat64HoleNaNOperator<CheckFloat64HoleMode::kNeverReturnHole>
kCheckFloat64HoleNeverReturnHoleOperator;
struct EnsureWritableFastElementsOperator final : public Operator {
EnsureWritableFastElementsOperator()
: Operator( // --
IrOpcode::kEnsureWritableFastElements, // opcode
Operator::kNoDeopt | Operator::kNoThrow, // flags
"EnsureWritableFastElements", // name
2, 1, 1, 1, 1, 0) {} // counts
};
EnsureWritableFastElementsOperator kEnsureWritableFastElements;
template <GrowFastElementsMode kMode>
struct GrowFastElementsOperator final
: public Operator1<GrowFastElementsParameters> {
GrowFastElementsOperator()
: Operator1(IrOpcode::kMaybeGrowFastElements, Operator::kNoThrow,
"MaybeGrowFastElements", 4, 1, 1, 1, 1, 0,
GrowFastElementsParameters(kMode, FeedbackSource())) {}
};
GrowFastElementsOperator<GrowFastElementsMode::kDoubleElements>
kGrowFastElementsOperatorDoubleElements;
GrowFastElementsOperator<GrowFastElementsMode::kSmiOrObjectElements>
kGrowFastElementsOperatorSmiOrObjectElements;
struct LoadFieldByIndexOperator final : public Operator {
LoadFieldByIndexOperator()
: Operator( // --
IrOpcode::kLoadFieldByIndex, // opcode
Operator::kEliminatable, // flags,
"LoadFieldByIndex", // name
2, 1, 1, 1, 1, 0) {} // counts;
};
LoadFieldByIndexOperator kLoadFieldByIndex;
struct LoadStackArgumentOperator final : public Operator {
LoadStackArgumentOperator()
: Operator( // --
IrOpcode::kLoadStackArgument, // opcode
Operator::kEliminatable, // flags
"LoadStackArgument", // name
2, 1, 1, 1, 1, 0) {} // counts
};
LoadStackArgumentOperator kLoadStackArgument;
#define SPECULATIVE_NUMBER_BINOP(Name) \
template <NumberOperationHint kHint> \
struct Name##Operator final : public Operator1<NumberOperationHint> { \
Name##Operator() \
: Operator1<NumberOperationHint>( \
IrOpcode::k##Name, Operator::kFoldable | Operator::kNoThrow, \
#Name, 2, 1, 1, 1, 1, 0, kHint) {} \
}; \
Name##Operator<NumberOperationHint::kSignedSmall> \
k##Name##SignedSmallOperator; \
Name##Operator<NumberOperationHint::kSignedSmallInputs> \
k##Name##SignedSmallInputsOperator; \
Name##Operator<NumberOperationHint::kSigned32> k##Name##Signed32Operator; \
Name##Operator<NumberOperationHint::kNumber> k##Name##NumberOperator; \
Name##Operator<NumberOperationHint::kNumberOrOddball> \
k##Name##NumberOrOddballOperator;
SPECULATIVE_NUMBER_BINOP_LIST(SPECULATIVE_NUMBER_BINOP)
#undef SPECULATIVE_NUMBER_BINOP
SpeculativeNumberEqualOperator<NumberOperationHint::kNumberOrBoolean>
kSpeculativeNumberEqualNumberOrBooleanOperator;
template <NumberOperationHint kHint>
struct SpeculativeToNumberOperator final
: public Operator1<NumberOperationParameters> {
SpeculativeToNumberOperator()
: Operator1<NumberOperationParameters>(
IrOpcode::kSpeculativeToNumber,
Operator::kFoldable | Operator::kNoThrow, "SpeculativeToNumber",
1, 1, 1, 1, 1, 0,
NumberOperationParameters(kHint, FeedbackSource())) {}
};
SpeculativeToNumberOperator<NumberOperationHint::kSignedSmall>
kSpeculativeToNumberSignedSmallOperator;
SpeculativeToNumberOperator<NumberOperationHint::kSigned32>
kSpeculativeToNumberSigned32Operator;
SpeculativeToNumberOperator<NumberOperationHint::kNumber>
kSpeculativeToNumberNumberOperator;
SpeculativeToNumberOperator<NumberOperationHint::kNumberOrOddball>
kSpeculativeToNumberNumberOrOddballOperator;
};
namespace {
DEFINE_LAZY_LEAKY_OBJECT_GETTER(SimplifiedOperatorGlobalCache,
GetSimplifiedOperatorGlobalCache)
}
SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone)
: cache_(*GetSimplifiedOperatorGlobalCache()), zone_(zone) {}
#define GET_FROM_CACHE(Name, ...) \
const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; }
PURE_OP_LIST(GET_FROM_CACHE)
EFFECT_DEPENDENT_OP_LIST(GET_FROM_CACHE)
CHECKED_OP_LIST(GET_FROM_CACHE)
GET_FROM_CACHE(ArgumentsFrame)
GET_FROM_CACHE(FindOrderedHashMapEntry)
GET_FROM_CACHE(FindOrderedHashMapEntryForInt32Key)
GET_FROM_CACHE(LoadFieldByIndex)
#undef GET_FROM_CACHE
#define GET_FROM_CACHE_WITH_FEEDBACK(Name, value_input_count, \
value_output_count) \
const Operator* SimplifiedOperatorBuilder::Name( \
const FeedbackSource& feedback) { \
if (!feedback.IsValid()) { \
return &cache_.k##Name; \
} \
return new (zone()) Operator1<CheckParameters>( \
IrOpcode::k##Name, Operator::kFoldable | Operator::kNoThrow, #Name, \
value_input_count, 1, 1, value_output_count, 1, 0, \
CheckParameters(feedback)); \
}
CHECKED_WITH_FEEDBACK_OP_LIST(GET_FROM_CACHE_WITH_FEEDBACK)
#undef GET_FROM_CACHE_WITH_FEEDBACK
#define GET_FROM_CACHE_WITH_FEEDBACK(Name) \
const Operator* SimplifiedOperatorBuilder::Name( \
const FeedbackSource& feedback, CheckBoundsFlags flags) { \
DCHECK(!(flags & CheckBoundsFlag::kConvertStringAndMinusZero)); \
if (!feedback.IsValid()) { \
if (flags & CheckBoundsFlag::kAbortOnOutOfBounds) { \
return &cache_.k##Name##Aborting; \
} else { \
return &cache_.k##Name; \
} \
} \
return new (zone()) \
SimplifiedOperatorGlobalCache::Name##Operator(feedback, flags); \
}
CHECKED_BOUNDS_OP_LIST(GET_FROM_CACHE_WITH_FEEDBACK)
#undef GET_FROM_CACHE_WITH_FEEDBACK
// For IrOpcode::kCheckBounds, we allow additional flags:
const Operator* SimplifiedOperatorBuilder::CheckBounds(
const FeedbackSource& feedback, CheckBoundsFlags flags) {
if (!feedback.IsValid()) {
if (flags & CheckBoundsFlag::kAbortOnOutOfBounds) {
if (flags & CheckBoundsFlag::kConvertStringAndMinusZero) {
return &cache_.kCheckBoundsAbortingAndConverting;
} else {
return &cache_.kCheckBoundsAborting;
}
} else {
if (flags & CheckBoundsFlag::kConvertStringAndMinusZero) {
return &cache_.kCheckBoundsConverting;
} else {
return &cache_.kCheckBounds;
}
}
}
return new (zone())
SimplifiedOperatorGlobalCache::CheckBoundsOperator(feedback, flags);
}
bool IsCheckedWithFeedback(const Operator* op) {
#define CASE(Name, ...) case IrOpcode::k##Name:
switch (op->opcode()) {
CHECKED_WITH_FEEDBACK_OP_LIST(CASE) return true;
default:
return false;
}
#undef CASE
}
const Operator* SimplifiedOperatorBuilder::RuntimeAbort(AbortReason reason) {
return new (zone()) Operator1<int>( // --
IrOpcode::kRuntimeAbort, // opcode
Operator::kNoThrow | Operator::kNoDeopt, // flags
"RuntimeAbort", // name
0, 1, 1, 0, 1, 0, // counts
static_cast<int>(reason)); // parameter
}
const Operator* SimplifiedOperatorBuilder::BigIntAsUintN(int bits) {
CHECK(0 <= bits && bits <= 64);
return new (zone()) Operator1<int>(IrOpcode::kBigIntAsUintN, Operator::kPure,
"BigIntAsUintN", 1, 0, 0, 1, 0, 0, bits);
}
const Operator* SimplifiedOperatorBuilder::AssertType(Type type) {
DCHECK(type.IsRange());
return new (zone()) Operator1<Type>(IrOpcode::kAssertType,
Operator::kNoThrow | Operator::kNoDeopt,
"AssertType", 1, 0, 0, 1, 0, 0, type);
}
const Operator* SimplifiedOperatorBuilder::FastApiCall(
const CFunctionInfo* signature, FeedbackSource const& feedback) {
// function, c args
int value_input_count = signature->ArgumentCount() + 1;
return new (zone()) Operator1<FastApiCallParameters>(
IrOpcode::kFastApiCall, Operator::kNoThrow, "FastApiCall",
value_input_count, 1, 1, 1, 1, 0,
FastApiCallParameters(signature, feedback));
}
const Operator* SimplifiedOperatorBuilder::CheckIf(
DeoptimizeReason reason, const FeedbackSource& feedback) {
if (!feedback.IsValid()) {
switch (reason) {
#define CHECK_IF(Name, message) \
case DeoptimizeReason::k##Name: \
return &cache_.kCheckIf##Name;
DEOPTIMIZE_REASON_LIST(CHECK_IF)
#undef CHECK_IF
}
}
return new (zone()) Operator1<CheckIfParameters>(
IrOpcode::kCheckIf, Operator::kFoldable | Operator::kNoThrow, "CheckIf",
1, 1, 1, 0, 1, 0, CheckIfParameters(reason, feedback));
}
const Operator* SimplifiedOperatorBuilder::ChangeFloat64ToTagged(
CheckForMinusZeroMode mode) {
switch (mode) {
case CheckForMinusZeroMode::kCheckForMinusZero:
return &cache_.kChangeFloat64ToTaggedCheckForMinusZeroOperator;
case CheckForMinusZeroMode::kDontCheckForMinusZero:
return &cache_.kChangeFloat64ToTaggedDontCheckForMinusZeroOperator;
}
UNREACHABLE();
}
const Operator* SimplifiedOperatorBuilder::CheckedInt32Mul(
CheckForMinusZeroMode mode) {
switch (mode) {
case CheckForMinusZeroMode::kCheckForMinusZero:
return &cache_.kCheckedInt32MulCheckForMinusZeroOperator;
case CheckForMinusZeroMode::kDontCheckForMinusZero:
return &cache_.kCheckedInt32MulDontCheckForMinusZeroOperator;
}
UNREACHABLE();
}
const Operator* SimplifiedOperatorBuilder::CheckedFloat64ToInt32(
CheckForMinusZeroMode mode, const FeedbackSource& feedback) {
if (!feedback.IsValid()) {
switch (mode) {
case CheckForMinusZeroMode::kCheckForMinusZero:
return &cache_.kCheckedFloat64ToInt32CheckForMinusZeroOperator;
case CheckForMinusZeroMode::kDontCheckForMinusZero:
return &cache_.kCheckedFloat64ToInt32DontCheckForMinusZeroOperator;
}
}
return new (zone()) Operator1<CheckMinusZeroParameters>(
IrOpcode::kCheckedFloat64ToInt32,
Operator::kFoldable | Operator::kNoThrow, "CheckedFloat64ToInt32", 1, 1,
1, 1, 1, 0, CheckMinusZeroParameters(mode, feedback));
}
const Operator* SimplifiedOperatorBuilder::CheckedFloat64ToInt64(
CheckForMinusZeroMode mode, const FeedbackSource& feedback) {
if (!feedback.IsValid()) {
switch (mode) {
case CheckForMinusZeroMode::kCheckForMinusZero:
return &cache_.kCheckedFloat64ToInt64CheckForMinusZeroOperator;
case CheckForMinusZeroMode::kDontCheckForMinusZero:
return &cache_.kCheckedFloat64ToInt64DontCheckForMinusZeroOperator;
}
}
return new (zone()) Operator1<CheckMinusZeroParameters>(
IrOpcode::kCheckedFloat64ToInt64,
Operator::kFoldable | Operator::kNoThrow, "CheckedFloat64ToInt64", 1, 1,
1, 1, 1, 0, CheckMinusZeroParameters(mode, feedback));
}
const Operator* SimplifiedOperatorBuilder::CheckedTaggedToInt32(
CheckForMinusZeroMode mode, const FeedbackSource& feedback) {
if (!feedback.IsValid()) {
switch (mode) {
case CheckForMinusZeroMode::kCheckForMinusZero:
return &cache_.kCheckedTaggedToInt32CheckForMinusZeroOperator;
case CheckForMinusZeroMode::kDontCheckForMinusZero:
return &cache_.kCheckedTaggedToInt32DontCheckForMinusZeroOperator;
}
}
return new (zone()) Operator1<CheckMinusZeroParameters>(
IrOpcode::kCheckedTaggedToInt32, Operator::kFoldable | Operator::kNoThrow,
"CheckedTaggedToInt32", 1, 1, 1, 1, 1, 0,
CheckMinusZeroParameters(mode, feedback));
}
const Operator* SimplifiedOperatorBuilder::CheckedTaggedToInt64(
CheckForMinusZeroMode mode, const FeedbackSource& feedback) {
if (!feedback.IsValid()) {
switch (mode) {
case CheckForMinusZeroMode::kCheckForMinusZero:
return &cache_.kCheckedTaggedToInt64CheckForMinusZeroOperator;
case CheckForMinusZeroMode::kDontCheckForMinusZero:
return &cache_.kCheckedTaggedToInt64DontCheckForMinusZeroOperator;
}
}
return new (zone()) Operator1<CheckMinusZeroParameters>(
IrOpcode::kCheckedTaggedToInt64, Operator::kFoldable | Operator::kNoThrow,
"CheckedTaggedToInt64", 1, 1, 1, 1, 1, 0,
CheckMinusZeroParameters(mode, feedback));
}
const Operator* SimplifiedOperatorBuilder::CheckedTaggedToFloat64(
CheckTaggedInputMode mode, const FeedbackSource& feedback) {
if (!feedback.IsValid()) {
switch (mode) {
case CheckTaggedInputMode::kNumber:
return &cache_.kCheckedTaggedToFloat64NumberOperator;
case CheckTaggedInputMode::kNumberOrBoolean:
return &cache_.kCheckedTaggedToFloat64NumberOrBooleanOperator;
case CheckTaggedInputMode::kNumberOrOddball:
return &cache_.kCheckedTaggedToFloat64NumberOrOddballOperator;
}
}
return new (zone()) Operator1<CheckTaggedInputParameters>(
IrOpcode::kCheckedTaggedToFloat64,
Operator::kFoldable | Operator::kNoThrow, "CheckedTaggedToFloat64", 1, 1,
1, 1, 1, 0, CheckTaggedInputParameters(mode, feedback));
}
const Operator* SimplifiedOperatorBuilder::CheckedTruncateTaggedToWord32(
CheckTaggedInputMode mode, const FeedbackSource& feedback) {
if (!feedback.IsValid()) {
switch (mode) {
case CheckTaggedInputMode::kNumber:
return &cache_.kCheckedTruncateTaggedToWord32NumberOperator;
case CheckTaggedInputMode::kNumberOrBoolean:
// Not used currently.
UNREACHABLE();
case CheckTaggedInputMode::kNumberOrOddball:
return &cache_.kCheckedTruncateTaggedToWord32NumberOrOddballOperator;
}
}
return new (zone()) Operator1<CheckTaggedInputParameters>(
IrOpcode::kCheckedTruncateTaggedToWord32,
Operator::kFoldable | Operator::kNoThrow, "CheckedTruncateTaggedToWord32",
1, 1, 1, 1, 1, 0, CheckTaggedInputParameters(mode, feedback));
}
const Operator* SimplifiedOperatorBuilder::CheckMaps(
CheckMapsFlags flags, ZoneHandleSet<Map> maps,
const FeedbackSource& feedback) {
CheckMapsParameters const parameters(flags, maps, feedback);
return new (zone()) Operator1<CheckMapsParameters>( // --
IrOpcode::kCheckMaps, // opcode
Operator::kNoThrow | Operator::kNoWrite, // flags
"CheckMaps", // name
1, 1, 1, 0, 1, 0, // counts
parameters); // parameter
}
const Operator* SimplifiedOperatorBuilder::MapGuard(ZoneHandleSet<Map> maps) {
DCHECK_LT(0, maps.size());
return new (zone()) Operator1<ZoneHandleSet<Map>>( // --
IrOpcode::kMapGuard, Operator::kEliminatable, // opcode
"MapGuard", // name
1, 1, 1, 0, 1, 0, // counts
maps); // parameter
}
const Operator* SimplifiedOperatorBuilder::CompareMaps(
ZoneHandleSet<Map> maps) {
DCHECK_LT(0, maps.size());
return new (zone()) Operator1<ZoneHandleSet<Map>>( // --
IrOpcode::kCompareMaps, // opcode
Operator::kNoThrow | Operator::kNoWrite, // flags
"CompareMaps", // name
1, 1, 1, 1, 1, 0, // counts
maps); // parameter
}
const Operator* SimplifiedOperatorBuilder::ConvertReceiver(
ConvertReceiverMode mode) {
switch (mode) {
case ConvertReceiverMode::kAny:
return &cache_.kConvertReceiverAnyOperator;
case ConvertReceiverMode::kNullOrUndefined:
return &cache_.kConvertReceiverNullOrUndefinedOperator;
case ConvertReceiverMode::kNotNullOrUndefined:
return &cache_.kConvertReceiverNotNullOrUndefinedOperator;
}
UNREACHABLE();
return nullptr;
}
const Operator* SimplifiedOperatorBuilder::CheckFloat64Hole(
CheckFloat64HoleMode mode, FeedbackSource const& feedback) {
if (!feedback.IsValid()) {
switch (mode) {
case CheckFloat64HoleMode::kAllowReturnHole:
return &cache_.kCheckFloat64HoleAllowReturnHoleOperator;
case CheckFloat64HoleMode::kNeverReturnHole:
return &cache_.kCheckFloat64HoleNeverReturnHoleOperator;
}
UNREACHABLE();
}
return new (zone()) Operator1<CheckFloat64HoleParameters>(
IrOpcode::kCheckFloat64Hole, Operator::kFoldable | Operator::kNoThrow,
"CheckFloat64Hole", 1, 1, 1, 1, 1, 0,
CheckFloat64HoleParameters(mode, feedback));
}
const Operator* SimplifiedOperatorBuilder::SpeculativeBigIntAdd(
BigIntOperationHint hint) {
return new (zone()) Operator1<BigIntOperationHint>(
IrOpcode::kSpeculativeBigIntAdd, Operator::kFoldable | Operator::kNoThrow,
"SpeculativeBigIntAdd", 2, 1, 1, 1, 1, 0, hint);
}
const Operator* SimplifiedOperatorBuilder::SpeculativeBigIntSubtract(
BigIntOperationHint hint) {
return new (zone()) Operator1<BigIntOperationHint>(
IrOpcode::kSpeculativeBigIntSubtract,
Operator::kFoldable | Operator::kNoThrow, "SpeculativeBigIntSubtract", 2,
1, 1, 1, 1, 0, hint);
}
const Operator* SimplifiedOperatorBuilder::SpeculativeBigIntNegate(
BigIntOperationHint hint) {
return new (zone()) Operator1<BigIntOperationHint>(
IrOpcode::kSpeculativeBigIntNegate,
Operator::kFoldable | Operator::kNoThrow, "SpeculativeBigIntNegate", 1, 1,
1, 1, 1, 0, hint);
}
const Operator* SimplifiedOperatorBuilder::CheckClosure(
const Handle<FeedbackCell>& feedback_cell) {
return new (zone()) Operator1<Handle<FeedbackCell>>( // --
IrOpcode::kCheckClosure, // opcode
Operator::kNoThrow | Operator::kNoWrite, // flags
"CheckClosure", // name
1, 1, 1, 1, 1, 0, // counts
feedback_cell); // parameter
}
Handle<FeedbackCell> FeedbackCellOf(const Operator* op) {
DCHECK(IrOpcode::kCheckClosure == op->opcode());
return OpParameter<Handle<FeedbackCell>>(op);
}
const Operator* SimplifiedOperatorBuilder::SpeculativeToNumber(
NumberOperationHint hint, const FeedbackSource& feedback) {
if (!feedback.IsValid()) {
switch (hint) {
case NumberOperationHint::kSignedSmall:
return &cache_.kSpeculativeToNumberSignedSmallOperator;
case NumberOperationHint::kSignedSmallInputs:
break;
case NumberOperationHint::kSigned32:
return &cache_.kSpeculativeToNumberSigned32Operator;
case NumberOperationHint::kNumber:
return &cache_.kSpeculativeToNumberNumberOperator;
case NumberOperationHint::kNumberOrBoolean:
// Not used currently.
UNREACHABLE();
case NumberOperationHint::kNumberOrOddball:
return &cache_.kSpeculativeToNumberNumberOrOddballOperator;
}
}
return new (zone()) Operator1<NumberOperationParameters>(
IrOpcode::kSpeculativeToNumber, Operator::kFoldable | Operator::kNoThrow,
"SpeculativeToNumber", 1, 1, 1, 1, 1, 0,
NumberOperationParameters(hint, feedback));
}
const Operator* SimplifiedOperatorBuilder::EnsureWritableFastElements() {
return &cache_.kEnsureWritableFastElements;
}
const Operator* SimplifiedOperatorBuilder::MaybeGrowFastElements(
GrowFastElementsMode mode, const FeedbackSource& feedback) {
if (!feedback.IsValid()) {
switch (mode) {
case GrowFastElementsMode::kDoubleElements:
return &cache_.kGrowFastElementsOperatorDoubleElements;
case GrowFastElementsMode::kSmiOrObjectElements:
return &cache_.kGrowFastElementsOperatorSmiOrObjectElements;
}
}
return new (zone()) Operator1<GrowFastElementsParameters>( // --
IrOpcode::kMaybeGrowFastElements, // opcode
Operator::kNoThrow, // flags
"MaybeGrowFastElements", // name
4, 1, 1, 1, 1, 0, // counts
GrowFastElementsParameters(mode, feedback)); // parameter
}
const Operator* SimplifiedOperatorBuilder::TransitionElementsKind(
ElementsTransition transition) {
return new (zone()) Operator1<ElementsTransition>( // --
IrOpcode::kTransitionElementsKind, // opcode
Operator::kNoThrow, // flags
"TransitionElementsKind", // name
1, 1, 1, 0, 1, 0, // counts
transition); // parameter
}
namespace {
struct ArgumentsLengthParameters {
int formal_parameter_count;
bool is_rest_length;
};
bool operator==(ArgumentsLengthParameters first,
ArgumentsLengthParameters second) {
return first.formal_parameter_count == second.formal_parameter_count &&
first.is_rest_length == second.is_rest_length;
}
size_t hash_value(ArgumentsLengthParameters param) {
return base::hash_combine(param.formal_parameter_count, param.is_rest_length);
}
std::ostream& operator<<(std::ostream& os, ArgumentsLengthParameters param) {
return os << param.formal_parameter_count << ", "
<< (param.is_rest_length ? "rest length" : "not rest length");
}
} // namespace
const Operator* SimplifiedOperatorBuilder::ArgumentsLength(
int formal_parameter_count, bool is_rest_length) {
return new (zone()) Operator1<ArgumentsLengthParameters>( // --
IrOpcode::kArgumentsLength, // opcode
Operator::kPure, // flags
"ArgumentsLength", // name
1, 0, 0, 1, 0, 0, // counts
ArgumentsLengthParameters{formal_parameter_count,
is_rest_length}); // parameter
}
int FormalParameterCountOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kArgumentsLength, op->opcode());
return OpParameter<ArgumentsLengthParameters>(op).formal_parameter_count;
}
bool IsRestLengthOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kArgumentsLength, op->opcode());
return OpParameter<ArgumentsLengthParameters>(op).is_rest_length;
}
bool operator==(CheckParameters const& lhs, CheckParameters const& rhs) {
return lhs.feedback() == rhs.feedback();
}
size_t hash_value(CheckParameters const& p) {
FeedbackSource::Hash feedback_hash;
return feedback_hash(p.feedback());
}
std::ostream& operator<<(std::ostream& os, CheckParameters const& p) {
return os << p.feedback();
}
CheckParameters const& CheckParametersOf(Operator const* op) {
if (op->opcode() == IrOpcode::kCheckBounds ||
op->opcode() == IrOpcode::kCheckedUint32Bounds ||
op->opcode() == IrOpcode::kCheckedUint64Bounds) {
return OpParameter<CheckBoundsParameters>(op).check_parameters();
}
#define MAKE_OR(name, arg2, arg3) op->opcode() == IrOpcode::k##name ||
CHECK((CHECKED_WITH_FEEDBACK_OP_LIST(MAKE_OR) false));
#undef MAKE_OR
return OpParameter<CheckParameters>(op);
}
bool operator==(CheckBoundsParameters const& lhs,
CheckBoundsParameters const& rhs) {
return lhs.check_parameters() == rhs.check_parameters() &&
lhs.flags() == rhs.flags();
}
size_t hash_value(CheckBoundsParameters const& p) {
return base::hash_combine(hash_value(p.check_parameters()), p.flags());
}
std::ostream& operator<<(std::ostream& os, CheckBoundsParameters const& p) {
os << p.check_parameters() << ", " << p.flags();
return os;
}
CheckBoundsParameters const& CheckBoundsParametersOf(Operator const* op) {
DCHECK(op->opcode() == IrOpcode::kCheckBounds ||
op->opcode() == IrOpcode::kCheckedUint32Bounds ||
op->opcode() == IrOpcode::kCheckedUint64Bounds);
return OpParameter<CheckBoundsParameters>(op);
}
bool operator==(CheckIfParameters const& lhs, CheckIfParameters const& rhs) {
return lhs.reason() == rhs.reason() && lhs.feedback() == rhs.feedback();
}
size_t hash_value(CheckIfParameters const& p) {
FeedbackSource::Hash feedback_hash;
return base::hash_combine(p.reason(), feedback_hash(p.feedback()));
}
std::ostream& operator<<(std::ostream& os, CheckIfParameters const& p) {
return os << p.reason() << ", " << p.feedback();
}
CheckIfParameters const& CheckIfParametersOf(Operator const* op) {
CHECK(op->opcode() == IrOpcode::kCheckIf);
return OpParameter<CheckIfParameters>(op);
}
const Operator* SimplifiedOperatorBuilder::NewDoubleElements(
AllocationType allocation) {
return new (zone()) Operator1<AllocationType>( // --
IrOpcode::kNewDoubleElements, // opcode
Operator::kEliminatable, // flags
"NewDoubleElements", // name
1, 1, 1, 1, 1, 0, // counts
allocation); // parameter
}
const Operator* SimplifiedOperatorBuilder::NewSmiOrObjectElements(
AllocationType allocation) {
return new (zone()) Operator1<AllocationType>( // --
IrOpcode::kNewSmiOrObjectElements, // opcode
Operator::kEliminatable, // flags
"NewSmiOrObjectElements", // name
1, 1, 1, 1, 1, 0, // counts
allocation); // parameter
}
const Operator* SimplifiedOperatorBuilder::NewArgumentsElements(
int mapped_count) {
return new (zone()) Operator1<int>( // --
IrOpcode::kNewArgumentsElements, // opcode
Operator::kEliminatable, // flags
"NewArgumentsElements", // name
2, 1, 0, 1, 1, 0, // counts
mapped_count); // parameter
}
int NewArgumentsElementsMappedCountOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kNewArgumentsElements, op->opcode());
return OpParameter<int>(op);
}
FastApiCallParameters const& FastApiCallParametersOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kFastApiCall, op->opcode());
return OpParameter<FastApiCallParameters>(op);
}
std::ostream& operator<<(std::ostream& os, FastApiCallParameters const& p) {
return os << p.signature() << ", " << p.feedback();
}
size_t hash_value(FastApiCallParameters const& p) {
return base::hash_combine(p.signature(),
FeedbackSource::Hash()(p.feedback()));
}
bool operator==(FastApiCallParameters const& lhs,
FastApiCallParameters const& rhs) {
return lhs.signature() == rhs.signature() && lhs.feedback() == rhs.feedback();
}
const Operator* SimplifiedOperatorBuilder::Allocate(Type type,
AllocationType allocation) {
return new (zone()) Operator1<AllocateParameters>(
IrOpcode::kAllocate, Operator::kEliminatable, "Allocate", 1, 1, 1, 1, 1,
0, AllocateParameters(type, allocation));
}
const Operator* SimplifiedOperatorBuilder::AllocateRaw(
Type type, AllocationType allocation,
AllowLargeObjects allow_large_objects) {
// We forbid optimized allocations to allocate in a different generation than
// requested.
DCHECK(!(allow_large_objects == AllowLargeObjects::kTrue &&
allocation == AllocationType::kYoung &&
!FLAG_young_generation_large_objects));
return new (zone()) Operator1<AllocateParameters>(
IrOpcode::kAllocateRaw, Operator::kEliminatable, "AllocateRaw", 1, 1, 1,
1, 1, 1, AllocateParameters(type, allocation, allow_large_objects));
}
#define SPECULATIVE_NUMBER_BINOP(Name) \
const Operator* SimplifiedOperatorBuilder::Name(NumberOperationHint hint) { \
switch (hint) { \
case NumberOperationHint::kSignedSmall: \
return &cache_.k##Name##SignedSmallOperator; \
case NumberOperationHint::kSignedSmallInputs: \
return &cache_.k##Name##SignedSmallInputsOperator; \
case NumberOperationHint::kSigned32: \
return &cache_.k##Name##Signed32Operator; \
case NumberOperationHint::kNumber: \
return &cache_.k##Name##NumberOperator; \
case NumberOperationHint::kNumberOrBoolean: \
/* Not used currenly. */ \
UNREACHABLE(); \
case NumberOperationHint::kNumberOrOddball: \
return &cache_.k##Name##NumberOrOddballOperator; \
} \
UNREACHABLE(); \
return nullptr; \
}
SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(SPECULATIVE_NUMBER_BINOP)
SPECULATIVE_NUMBER_BINOP(SpeculativeNumberLessThan)
SPECULATIVE_NUMBER_BINOP(SpeculativeNumberLessThanOrEqual)
#undef SPECULATIVE_NUMBER_BINOP
const Operator* SimplifiedOperatorBuilder::SpeculativeNumberEqual(
NumberOperationHint hint) {
switch (hint) {
case NumberOperationHint::kSignedSmall:
return &cache_.kSpeculativeNumberEqualSignedSmallOperator;
case NumberOperationHint::kSignedSmallInputs:
return &cache_.kSpeculativeNumberEqualSignedSmallInputsOperator;
case NumberOperationHint::kSigned32:
return &cache_.kSpeculativeNumberEqualSigned32Operator;
case NumberOperationHint::kNumber:
return &cache_.kSpeculativeNumberEqualNumberOperator;
case NumberOperationHint::kNumberOrBoolean:
return &cache_.kSpeculativeNumberEqualNumberOrBooleanOperator;
case NumberOperationHint::kNumberOrOddball:
return &cache_.kSpeculativeNumberEqualNumberOrOddballOperator;
}
UNREACHABLE();
return nullptr;
}
#define ACCESS_OP_LIST(V) \
V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1, 1) \
V(StoreField, FieldAccess, Operator::kNoRead, 2, 1, 0) \
V(LoadElement, ElementAccess, Operator::kNoWrite, 2, 1, 1) \
V(StoreElement, ElementAccess, Operator::kNoRead, 3, 1, 0) \
V(LoadTypedElement, ExternalArrayType, Operator::kNoWrite, 4, 1, 1) \
V(LoadFromObject, ObjectAccess, Operator::kNoWrite, 2, 1, 1) \
V(StoreTypedElement, ExternalArrayType, Operator::kNoRead, 5, 1, 0) \
V(StoreToObject, ObjectAccess, Operator::kNoRead, 3, 1, 0) \
V(LoadDataViewElement, ExternalArrayType, Operator::kNoWrite, 4, 1, 1) \
V(StoreDataViewElement, ExternalArrayType, Operator::kNoRead, 5, 1, 0)
#define ACCESS(Name, Type, properties, value_input_count, control_input_count, \
output_count) \
const Operator* SimplifiedOperatorBuilder::Name(const Type& access) { \
return new (zone()) \
Operator1<Type>(IrOpcode::k##Name, \
Operator::kNoDeopt | Operator::kNoThrow | properties, \
#Name, value_input_count, 1, control_input_count, \
output_count, 1, 0, access); \
}
ACCESS_OP_LIST(ACCESS)
#undef ACCESS
const Operator* SimplifiedOperatorBuilder::LoadMessage() {
return new (zone()) Operator(IrOpcode::kLoadMessage, Operator::kEliminatable,
"LoadMessage", 1, 1, 1, 1, 1, 0);
}
const Operator* SimplifiedOperatorBuilder::StoreMessage() {
return new (zone())
Operator(IrOpcode::kStoreMessage,
Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoRead,
"StoreMessage", 2, 1, 1, 0, 1, 0);
}
const Operator* SimplifiedOperatorBuilder::LoadStackArgument() {
return &cache_.kLoadStackArgument;
}
const Operator* SimplifiedOperatorBuilder::TransitionAndStoreElement(
Handle<Map> double_map, Handle<Map> fast_map) {
TransitionAndStoreElementParameters parameters(double_map, fast_map);
return new (zone()) Operator1<TransitionAndStoreElementParameters>(
IrOpcode::kTransitionAndStoreElement,
Operator::kNoDeopt | Operator::kNoThrow, "TransitionAndStoreElement", 3,
1, 1, 0, 1, 0, parameters);
}
const Operator* SimplifiedOperatorBuilder::StoreSignedSmallElement() {
return new (zone()) Operator(IrOpcode::kStoreSignedSmallElement,
Operator::kNoDeopt | Operator::kNoThrow,
"StoreSignedSmallElement", 3, 1, 1, 0, 1, 0);
}
const Operator* SimplifiedOperatorBuilder::TransitionAndStoreNumberElement(
Handle<Map> double_map) {
TransitionAndStoreNumberElementParameters parameters(double_map);
return new (zone()) Operator1<TransitionAndStoreNumberElementParameters>(
IrOpcode::kTransitionAndStoreNumberElement,
Operator::kNoDeopt | Operator::kNoThrow,
"TransitionAndStoreNumberElement", 3, 1, 1, 0, 1, 0, parameters);
}
const Operator* SimplifiedOperatorBuilder::TransitionAndStoreNonNumberElement(
Handle<Map> fast_map, Type value_type) {
TransitionAndStoreNonNumberElementParameters parameters(fast_map, value_type);
return new (zone()) Operator1<TransitionAndStoreNonNumberElementParameters>(
IrOpcode::kTransitionAndStoreNonNumberElement,
Operator::kNoDeopt | Operator::kNoThrow,
"TransitionAndStoreNonNumberElement", 3, 1, 1, 0, 1, 0, parameters);
}
#undef PURE_OP_LIST
#undef EFFECT_DEPENDENT_OP_LIST
#undef SPECULATIVE_NUMBER_BINOP_LIST
#undef CHECKED_WITH_FEEDBACK_OP_LIST
#undef CHECKED_BOUNDS_OP_LIST
#undef CHECKED_OP_LIST
#undef ACCESS_OP_LIST
} // namespace compiler
} // namespace internal
} // namespace v8
|
#include <cstdio>
#include <cassert>
#include <queue>
#include <iostream>
#define MAX_NODES 600000
typedef struct
{
char state;
int par;
long long balls;
int left, right;
} node_t;
using namespace std;
node_t nodes[MAX_NODES + 1];
bool vis[MAX_NODES];
void dfs(int node)
{
if(node == 0 || vis[node])
return;
vis[node] = true;
nodes[nodes[node].left].par ++;
nodes[nodes[node].right].par ++;
dfs(nodes[node].left);
dfs(nodes[node].right);
}
int main(void)
{
ios_base::sync_with_stdio(0); cin.tie(0);
int m;
int i;
std::queue<int> q;
cin >> nodes[1].balls >> m;
for(i = 0; i <= m; i ++)
nodes[i].par = 0;
nodes[0].balls = 0;
for(i = 1; i <= m; i ++)
{
cin >> nodes[i].state >> nodes[i].left >> nodes[i].right;
//scanf(" %c %d %d", &nodes[i].state, &nodes[i].left, &nodes[i].right);
assert(nodes[i].state == 'L' || nodes[i].state == 'R');
if(i != 1) nodes[i].balls = 0;
/* nodes[nodes[i].left].par ++;
nodes[nodes[i].right].par ++;*/
}
dfs(1);
//assert(nodes[1].par == 0);
q.push(1);
while(!q.empty())
{
i = q.front();
q.pop();
if(i == 0)
{
assert(q.empty());
break;
}
nodes[nodes[i].left].balls += nodes[i].balls / 2;
nodes[nodes[i].right].balls += nodes[i].balls / 2;
if(nodes[i].balls % 2 == 1)
{
if(nodes[i].state == 'L')
{
nodes[i].state = 'R';
nodes[nodes[i].left].balls ++;
}
else
{
nodes[i].state = 'L';
nodes[nodes[i].right].balls ++;
}
}
if((-- nodes[nodes[i].left].par) == 0)
q.push(nodes[i].left);
if((-- nodes[nodes[i].right].par) == 0)
q.push(nodes[i].right);
}
assert(nodes[0].balls == nodes[1].balls);
for(i = 1; i <= m; i ++)
cout << nodes[i].state;
cout << '\n';
return 0;
}
|
#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED
#define BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
//
// Copyright (c) 2008 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <boost/assert.hpp>
namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost
{
namespace detail
{
class spinlock
{
public:
bool locked_;
public:
inline bool try_lock()
{
if( locked_ )
{
return false;
}
else
{
locked_ = true;
return true;
}
}
inline void lock()
{
BOOST_ASSERT( !locked_ );
locked_ = true;
}
inline void unlock()
{
BOOST_ASSERT( locked_ );
locked_ = false;
}
public:
class scoped_lock
{
private:
spinlock & sp_;
scoped_lock( scoped_lock const & );
scoped_lock & operator=( scoped_lock const & );
public:
explicit scoped_lock( spinlock & sp ): sp_( sp )
{
sp.lock();
}
~scoped_lock()
{
sp_.unlock();
}
};
};
} // namespace detail
} // namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost
#define BOOST_DETAIL_SPINLOCK_INIT { false }
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED
|
/* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ===========================================================================*/
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
#include "tfjs-backend-wasm/src/cc/binary.h"
#include "tfjs-backend-wasm/src/cc/util.h"
namespace {
inline bool logical_xor(bool a, bool b) { return a != b; }
} // namespace
namespace tfjs {
namespace wasm {
// We use C-style API to interface with Javascript.
extern "C" {
#ifdef __EMSCRIPTEN__
EMSCRIPTEN_KEEPALIVE
#endif
void LogicalXor(const int a_id, const size_t *a_shape_ptr,
const int a_shape_len, const int b_id,
const size_t *b_shape_ptr, const int b_shape_len,
const DType input_type, const int out_id) {
switch (input_type) {
case DType::boolean:
compare_bool(a_id, a_shape_ptr, a_shape_len, b_id, b_shape_ptr,
b_shape_len, out_id, logical_xor);
break;
default:
util::warn(
"LogicalXor for tensor ids %d and %d failed. Unsupported input_type "
"%d",
a_id, b_id, input_type);
}
}
} // extern "C"
} // namespace wasm
} // namespace tfjs
|
/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "modules/audio_coding/codecs/opus/audio_encoder_opus.h"
#include <algorithm>
#include <iterator>
#include <memory>
#include <string>
#include <utility>
#include "absl/strings/match.h"
#include "modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.h"
#include "modules/audio_coding/audio_network_adaptor/controller_manager.h"
#include "modules/audio_coding/codecs/opus/audio_coder_opus_common.h"
#include "modules/audio_coding/codecs/opus/opus_interface.h"
#include "rtc_base/arraysize.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/exp_filter.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/numerics/safe_minmax.h"
#include "rtc_base/string_encode.h"
#include "rtc_base/string_to_number.h"
#include "rtc_base/time_utils.h"
#include "system_wrappers/include/field_trial.h"
namespace webrtc {
namespace {
// Codec parameters for Opus.
// draft-spittka-payload-rtp-opus-03
// Recommended bitrates:
// 8-12 kb/s for NB speech,
// 16-20 kb/s for WB speech,
// 28-40 kb/s for FB speech,
// 48-64 kb/s for FB mono music, and
// 64-128 kb/s for FB stereo music.
// The current implementation applies the following values to mono signals,
// and multiplies them by 2 for stereo.
constexpr int kOpusBitrateNbBps = 12000;
constexpr int kOpusBitrateWbBps = 20000;
constexpr int kOpusBitrateFbBps = 32000;
constexpr int kRtpTimestampRateHz = 48000;
constexpr int kDefaultMaxPlaybackRate = 48000;
// These two lists must be sorted from low to high
#if WEBRTC_OPUS_SUPPORT_120MS_PTIME
constexpr int kANASupportedFrameLengths[] = {20, 40, 60, 120};
constexpr int kOpusSupportedFrameLengths[] = {10, 20, 40, 60, 120};
#else
constexpr int kANASupportedFrameLengths[] = {20, 40, 60};
constexpr int kOpusSupportedFrameLengths[] = {10, 20, 40, 60};
#endif
// PacketLossFractionSmoother uses an exponential filter with a time constant
// of -1.0 / ln(0.9999) = 10000 ms.
constexpr float kAlphaForPacketLossFractionSmoother = 0.9999f;
constexpr float kMaxPacketLossFraction = 0.2f;
int CalculateDefaultBitrate(int max_playback_rate, size_t num_channels) {
const int bitrate = [&] {
if (max_playback_rate <= 8000) {
return kOpusBitrateNbBps * rtc::dchecked_cast<int>(num_channels);
} else if (max_playback_rate <= 16000) {
return kOpusBitrateWbBps * rtc::dchecked_cast<int>(num_channels);
} else {
return kOpusBitrateFbBps * rtc::dchecked_cast<int>(num_channels);
}
}();
RTC_DCHECK_GE(bitrate, AudioEncoderOpusConfig::kMinBitrateBps);
RTC_DCHECK_LE(bitrate, AudioEncoderOpusConfig::kMaxBitrateBps);
return bitrate;
}
// Get the maxaveragebitrate parameter in string-form, so we can properly figure
// out how invalid it is and accurately log invalid values.
int CalculateBitrate(int max_playback_rate_hz,
size_t num_channels,
absl::optional<std::string> bitrate_param) {
const int default_bitrate =
CalculateDefaultBitrate(max_playback_rate_hz, num_channels);
if (bitrate_param) {
const auto bitrate = rtc::StringToNumber<int>(*bitrate_param);
if (bitrate) {
const int chosen_bitrate =
std::max(AudioEncoderOpusConfig::kMinBitrateBps,
std::min(*bitrate, AudioEncoderOpusConfig::kMaxBitrateBps));
if (bitrate != chosen_bitrate) {
RTC_LOG(LS_WARNING) << "Invalid maxaveragebitrate " << *bitrate
<< " clamped to " << chosen_bitrate;
}
return chosen_bitrate;
}
RTC_LOG(LS_WARNING) << "Invalid maxaveragebitrate \"" << *bitrate_param
<< "\" replaced by default bitrate " << default_bitrate;
}
return default_bitrate;
}
int GetChannelCount(const SdpAudioFormat& format) {
const auto param = GetFormatParameter(format, "stereo");
if (param == "1") {
return 2;
} else {
return 1;
}
}
int GetMaxPlaybackRate(const SdpAudioFormat& format) {
const auto param = GetFormatParameter<int>(format, "maxplaybackrate");
if (param && *param >= 8000) {
return std::min(*param, kDefaultMaxPlaybackRate);
}
return kDefaultMaxPlaybackRate;
}
int GetFrameSizeMs(const SdpAudioFormat& format) {
const auto ptime = GetFormatParameter<int>(format, "ptime");
if (ptime) {
// Pick the next highest supported frame length from
// kOpusSupportedFrameLengths.
for (const int supported_frame_length : kOpusSupportedFrameLengths) {
if (supported_frame_length >= *ptime) {
return supported_frame_length;
}
}
// If none was found, return the largest supported frame length.
return *(std::end(kOpusSupportedFrameLengths) - 1);
}
return AudioEncoderOpusConfig::kDefaultFrameSizeMs;
}
void FindSupportedFrameLengths(int min_frame_length_ms,
int max_frame_length_ms,
std::vector<int>* out) {
out->clear();
std::copy_if(std::begin(kANASupportedFrameLengths),
std::end(kANASupportedFrameLengths), std::back_inserter(*out),
[&](int frame_length_ms) {
return frame_length_ms >= min_frame_length_ms &&
frame_length_ms <= max_frame_length_ms;
});
RTC_DCHECK(std::is_sorted(out->begin(), out->end()));
}
int GetBitrateBps(const AudioEncoderOpusConfig& config) {
RTC_DCHECK(config.IsOk());
return *config.bitrate_bps;
}
std::vector<float> GetBitrateMultipliers() {
constexpr char kBitrateMultipliersName[] =
"WebRTC-Audio-OpusBitrateMultipliers";
const bool use_bitrate_multipliers =
webrtc::field_trial::IsEnabled(kBitrateMultipliersName);
if (use_bitrate_multipliers) {
const std::string field_trial_string =
webrtc::field_trial::FindFullName(kBitrateMultipliersName);
std::vector<std::string> pieces;
rtc::tokenize(field_trial_string, '-', &pieces);
if (pieces.size() < 2 || pieces[0] != "Enabled") {
RTC_LOG(LS_WARNING) << "Invalid parameters for "
<< kBitrateMultipliersName
<< ", not using custom values.";
return std::vector<float>();
}
std::vector<float> multipliers(pieces.size() - 1);
for (size_t i = 1; i < pieces.size(); i++) {
if (!rtc::FromString(pieces[i], &multipliers[i - 1])) {
RTC_LOG(LS_WARNING)
<< "Invalid parameters for " << kBitrateMultipliersName
<< ", not using custom values.";
return std::vector<float>();
}
}
RTC_LOG(LS_INFO) << "Using custom bitrate multipliers: "
<< field_trial_string;
return multipliers;
}
return std::vector<float>();
}
int GetMultipliedBitrate(int bitrate, const std::vector<float>& multipliers) {
// The multipliers are valid from 5 kbps.
const size_t bitrate_kbps = static_cast<size_t>(bitrate / 1000);
if (bitrate_kbps < 5 || bitrate_kbps >= multipliers.size() + 5) {
return bitrate;
}
return static_cast<int>(multipliers[bitrate_kbps - 5] * bitrate);
}
} // namespace
void AudioEncoderOpusImpl::AppendSupportedEncoders(
std::vector<AudioCodecSpec>* specs) {
const SdpAudioFormat fmt = {"opus",
kRtpTimestampRateHz,
2,
{{"minptime", "10"}, {"useinbandfec", "1"}}};
const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt));
specs->push_back({fmt, info});
}
AudioCodecInfo AudioEncoderOpusImpl::QueryAudioEncoder(
const AudioEncoderOpusConfig& config) {
RTC_DCHECK(config.IsOk());
AudioCodecInfo info(config.sample_rate_hz, config.num_channels,
*config.bitrate_bps,
AudioEncoderOpusConfig::kMinBitrateBps,
AudioEncoderOpusConfig::kMaxBitrateBps);
info.allow_comfort_noise = false;
info.supports_network_adaption = true;
return info;
}
std::unique_ptr<AudioEncoder> AudioEncoderOpusImpl::MakeAudioEncoder(
const AudioEncoderOpusConfig& config,
int payload_type) {
RTC_DCHECK(config.IsOk());
return std::make_unique<AudioEncoderOpusImpl>(config, payload_type);
}
absl::optional<AudioEncoderOpusConfig> AudioEncoderOpusImpl::SdpToConfig(
const SdpAudioFormat& format) {
if (!absl::EqualsIgnoreCase(format.name, "opus") ||
format.clockrate_hz != kRtpTimestampRateHz || format.num_channels != 2) {
return absl::nullopt;
}
AudioEncoderOpusConfig config;
config.num_channels = GetChannelCount(format);
config.frame_size_ms = GetFrameSizeMs(format);
config.max_playback_rate_hz = GetMaxPlaybackRate(format);
config.fec_enabled = (GetFormatParameter(format, "useinbandfec") == "1");
config.dtx_enabled = (GetFormatParameter(format, "usedtx") == "1");
config.cbr_enabled = (GetFormatParameter(format, "cbr") == "1");
config.bitrate_bps =
CalculateBitrate(config.max_playback_rate_hz, config.num_channels,
GetFormatParameter(format, "maxaveragebitrate"));
config.application = config.num_channels == 1
? AudioEncoderOpusConfig::ApplicationMode::kVoip
: AudioEncoderOpusConfig::ApplicationMode::kAudio;
constexpr int kMinANAFrameLength = kANASupportedFrameLengths[0];
constexpr int kMaxANAFrameLength =
kANASupportedFrameLengths[arraysize(kANASupportedFrameLengths) - 1];
// For now, minptime and maxptime are only used with ANA. If ptime is outside
// of this range, it will get adjusted once ANA takes hold. Ideally, we'd know
// if ANA was to be used when setting up the config, and adjust accordingly.
const int min_frame_length_ms =
GetFormatParameter<int>(format, "minptime").value_or(kMinANAFrameLength);
const int max_frame_length_ms =
GetFormatParameter<int>(format, "maxptime").value_or(kMaxANAFrameLength);
FindSupportedFrameLengths(min_frame_length_ms, max_frame_length_ms,
&config.supported_frame_lengths_ms);
RTC_DCHECK(config.IsOk());
return config;
}
absl::optional<int> AudioEncoderOpusImpl::GetNewComplexity(
const AudioEncoderOpusConfig& config) {
RTC_DCHECK(config.IsOk());
const int bitrate_bps = GetBitrateBps(config);
if (bitrate_bps >= config.complexity_threshold_bps -
config.complexity_threshold_window_bps &&
bitrate_bps <= config.complexity_threshold_bps +
config.complexity_threshold_window_bps) {
// Within the hysteresis window; make no change.
return absl::nullopt;
} else {
return bitrate_bps <= config.complexity_threshold_bps
? config.low_rate_complexity
: config.complexity;
}
}
absl::optional<int> AudioEncoderOpusImpl::GetNewBandwidth(
const AudioEncoderOpusConfig& config,
OpusEncInst* inst) {
constexpr int kMinWidebandBitrate = 8000;
constexpr int kMaxNarrowbandBitrate = 9000;
constexpr int kAutomaticThreshold = 11000;
RTC_DCHECK(config.IsOk());
const int bitrate = GetBitrateBps(config);
if (bitrate > kAutomaticThreshold) {
return absl::optional<int>(OPUS_AUTO);
}
const int bandwidth = WebRtcOpus_GetBandwidth(inst);
RTC_DCHECK_GE(bandwidth, 0);
if (bitrate > kMaxNarrowbandBitrate && bandwidth < OPUS_BANDWIDTH_WIDEBAND) {
return absl::optional<int>(OPUS_BANDWIDTH_WIDEBAND);
} else if (bitrate < kMinWidebandBitrate &&
bandwidth > OPUS_BANDWIDTH_NARROWBAND) {
return absl::optional<int>(OPUS_BANDWIDTH_NARROWBAND);
}
return absl::optional<int>();
}
class AudioEncoderOpusImpl::PacketLossFractionSmoother {
public:
explicit PacketLossFractionSmoother()
: last_sample_time_ms_(rtc::TimeMillis()),
smoother_(kAlphaForPacketLossFractionSmoother) {}
// Gets the smoothed packet loss fraction.
float GetAverage() const {
float value = smoother_.filtered();
return (value == rtc::ExpFilter::kValueUndefined) ? 0.0f : value;
}
// Add new observation to the packet loss fraction smoother.
void AddSample(float packet_loss_fraction) {
int64_t now_ms = rtc::TimeMillis();
smoother_.Apply(static_cast<float>(now_ms - last_sample_time_ms_),
packet_loss_fraction);
last_sample_time_ms_ = now_ms;
}
private:
int64_t last_sample_time_ms_;
// An exponential filter is used to smooth the packet loss fraction.
rtc::ExpFilter smoother_;
};
AudioEncoderOpusImpl::AudioEncoderOpusImpl(const AudioEncoderOpusConfig& config,
int payload_type)
: AudioEncoderOpusImpl(
config,
payload_type,
[this](const std::string& config_string, RtcEventLog* event_log) {
return DefaultAudioNetworkAdaptorCreator(config_string, event_log);
},
// We choose 5sec as initial time constant due to empirical data.
std::make_unique<SmoothingFilterImpl>(5000)) {}
AudioEncoderOpusImpl::AudioEncoderOpusImpl(
const AudioEncoderOpusConfig& config,
int payload_type,
const AudioNetworkAdaptorCreator& audio_network_adaptor_creator,
std::unique_ptr<SmoothingFilter> bitrate_smoother)
: payload_type_(payload_type),
send_side_bwe_with_overhead_(
webrtc::field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")),
use_stable_target_for_adaptation_(webrtc::field_trial::IsEnabled(
"WebRTC-Audio-StableTargetAdaptation")),
adjust_bandwidth_(
webrtc::field_trial::IsEnabled("WebRTC-AdjustOpusBandwidth")),
bitrate_changed_(true),
bitrate_multipliers_(GetBitrateMultipliers()),
packet_loss_rate_(0.0),
inst_(nullptr),
packet_loss_fraction_smoother_(new PacketLossFractionSmoother()),
audio_network_adaptor_creator_(audio_network_adaptor_creator),
bitrate_smoother_(std::move(bitrate_smoother)),
consecutive_dtx_frames_(0) {
RTC_DCHECK(0 <= payload_type && payload_type <= 127);
// Sanity check of the redundant payload type field that we want to get rid
// of. See https://bugs.chromium.org/p/webrtc/issues/detail?id=7847
RTC_CHECK(config.payload_type == -1 || config.payload_type == payload_type);
RTC_CHECK(RecreateEncoderInstance(config));
SetProjectedPacketLossRate(packet_loss_rate_);
}
AudioEncoderOpusImpl::AudioEncoderOpusImpl(int payload_type,
const SdpAudioFormat& format)
: AudioEncoderOpusImpl(*SdpToConfig(format), payload_type) {}
AudioEncoderOpusImpl::~AudioEncoderOpusImpl() {
RTC_CHECK_EQ(0, WebRtcOpus_EncoderFree(inst_));
}
int AudioEncoderOpusImpl::SampleRateHz() const {
return config_.sample_rate_hz;
}
size_t AudioEncoderOpusImpl::NumChannels() const {
return config_.num_channels;
}
int AudioEncoderOpusImpl::RtpTimestampRateHz() const {
return kRtpTimestampRateHz;
}
size_t AudioEncoderOpusImpl::Num10MsFramesInNextPacket() const {
return Num10msFramesPerPacket();
}
size_t AudioEncoderOpusImpl::Max10MsFramesInAPacket() const {
return Num10msFramesPerPacket();
}
int AudioEncoderOpusImpl::GetTargetBitrate() const {
return GetBitrateBps(config_);
}
void AudioEncoderOpusImpl::Reset() {
RTC_CHECK(RecreateEncoderInstance(config_));
}
bool AudioEncoderOpusImpl::SetFec(bool enable) {
if (enable) {
RTC_CHECK_EQ(0, WebRtcOpus_EnableFec(inst_));
} else {
RTC_CHECK_EQ(0, WebRtcOpus_DisableFec(inst_));
}
config_.fec_enabled = enable;
return true;
}
bool AudioEncoderOpusImpl::SetDtx(bool enable) {
if (enable) {
RTC_CHECK_EQ(0, WebRtcOpus_EnableDtx(inst_));
} else {
RTC_CHECK_EQ(0, WebRtcOpus_DisableDtx(inst_));
}
config_.dtx_enabled = enable;
return true;
}
bool AudioEncoderOpusImpl::GetDtx() const {
return config_.dtx_enabled;
}
bool AudioEncoderOpusImpl::SetApplication(Application application) {
auto conf = config_;
switch (application) {
case Application::kSpeech:
conf.application = AudioEncoderOpusConfig::ApplicationMode::kVoip;
break;
case Application::kAudio:
conf.application = AudioEncoderOpusConfig::ApplicationMode::kAudio;
break;
}
return RecreateEncoderInstance(conf);
}
void AudioEncoderOpusImpl::SetMaxPlaybackRate(int frequency_hz) {
auto conf = config_;
conf.max_playback_rate_hz = frequency_hz;
RTC_CHECK(RecreateEncoderInstance(conf));
}
bool AudioEncoderOpusImpl::EnableAudioNetworkAdaptor(
const std::string& config_string,
RtcEventLog* event_log) {
audio_network_adaptor_ =
audio_network_adaptor_creator_(config_string, event_log);
return audio_network_adaptor_.get() != nullptr;
}
void AudioEncoderOpusImpl::DisableAudioNetworkAdaptor() {
audio_network_adaptor_.reset(nullptr);
}
void AudioEncoderOpusImpl::OnReceivedUplinkPacketLossFraction(
float uplink_packet_loss_fraction) {
if (audio_network_adaptor_) {
audio_network_adaptor_->SetUplinkPacketLossFraction(
uplink_packet_loss_fraction);
ApplyAudioNetworkAdaptor();
}
packet_loss_fraction_smoother_->AddSample(uplink_packet_loss_fraction);
float average_fraction_loss = packet_loss_fraction_smoother_->GetAverage();
SetProjectedPacketLossRate(average_fraction_loss);
}
void AudioEncoderOpusImpl::OnReceivedTargetAudioBitrate(
int target_audio_bitrate_bps) {
SetTargetBitrate(target_audio_bitrate_bps);
}
void AudioEncoderOpusImpl::OnReceivedUplinkBandwidth(
int target_audio_bitrate_bps,
absl::optional<int64_t> bwe_period_ms,
absl::optional<int64_t> stable_target_bitrate_bps) {
if (audio_network_adaptor_) {
audio_network_adaptor_->SetTargetAudioBitrate(target_audio_bitrate_bps);
if (use_stable_target_for_adaptation_) {
if (stable_target_bitrate_bps)
audio_network_adaptor_->SetUplinkBandwidth(*stable_target_bitrate_bps);
} else {
// We give smoothed bitrate allocation to audio network adaptor as
// the uplink bandwidth.
// The BWE spikes should not affect the bitrate smoother more than 25%.
// To simplify the calculations we use a step response as input signal.
// The step response of an exponential filter is
// u(t) = 1 - e^(-t / time_constant).
// In order to limit the affect of a BWE spike within 25% of its value
// before
// the next BWE update, we would choose a time constant that fulfills
// 1 - e^(-bwe_period_ms / time_constant) < 0.25
// Then 4 * bwe_period_ms is a good choice.
if (bwe_period_ms)
bitrate_smoother_->SetTimeConstantMs(*bwe_period_ms * 4);
bitrate_smoother_->AddSample(target_audio_bitrate_bps);
}
ApplyAudioNetworkAdaptor();
} else if (send_side_bwe_with_overhead_) {
if (!overhead_bytes_per_packet_) {
RTC_LOG(LS_INFO)
<< "AudioEncoderOpusImpl: Overhead unknown, target audio bitrate "
<< target_audio_bitrate_bps << " bps is ignored.";
return;
}
const int overhead_bps = static_cast<int>(
*overhead_bytes_per_packet_ * 8 * 100 / Num10MsFramesInNextPacket());
SetTargetBitrate(
std::min(AudioEncoderOpusConfig::kMaxBitrateBps,
std::max(AudioEncoderOpusConfig::kMinBitrateBps,
target_audio_bitrate_bps - overhead_bps)));
} else {
SetTargetBitrate(target_audio_bitrate_bps);
}
}
void AudioEncoderOpusImpl::OnReceivedUplinkBandwidth(
int target_audio_bitrate_bps,
absl::optional<int64_t> bwe_period_ms) {
OnReceivedUplinkBandwidth(target_audio_bitrate_bps, bwe_period_ms,
absl::nullopt);
}
void AudioEncoderOpusImpl::OnReceivedUplinkAllocation(
BitrateAllocationUpdate update) {
OnReceivedUplinkBandwidth(update.target_bitrate.bps(), update.bwe_period.ms(),
update.stable_target_bitrate.bps());
}
void AudioEncoderOpusImpl::OnReceivedRtt(int rtt_ms) {
if (!audio_network_adaptor_)
return;
audio_network_adaptor_->SetRtt(rtt_ms);
ApplyAudioNetworkAdaptor();
}
void AudioEncoderOpusImpl::OnReceivedOverhead(
size_t overhead_bytes_per_packet) {
if (audio_network_adaptor_) {
audio_network_adaptor_->SetOverhead(overhead_bytes_per_packet);
ApplyAudioNetworkAdaptor();
} else {
overhead_bytes_per_packet_ = overhead_bytes_per_packet;
}
}
void AudioEncoderOpusImpl::SetReceiverFrameLengthRange(
int min_frame_length_ms,
int max_frame_length_ms) {
// Ensure that |SetReceiverFrameLengthRange| is called before
// |EnableAudioNetworkAdaptor|, otherwise we need to recreate
// |audio_network_adaptor_|, which is not a needed use case.
RTC_DCHECK(!audio_network_adaptor_);
FindSupportedFrameLengths(min_frame_length_ms, max_frame_length_ms,
&config_.supported_frame_lengths_ms);
}
AudioEncoder::EncodedInfo AudioEncoderOpusImpl::EncodeImpl(
uint32_t rtp_timestamp,
rtc::ArrayView<const int16_t> audio,
rtc::Buffer* encoded) {
MaybeUpdateUplinkBandwidth();
if (input_buffer_.empty())
first_timestamp_in_buffer_ = rtp_timestamp;
input_buffer_.insert(input_buffer_.end(), audio.cbegin(), audio.cend());
if (input_buffer_.size() <
(Num10msFramesPerPacket() * SamplesPer10msFrame())) {
return EncodedInfo();
}
RTC_CHECK_EQ(input_buffer_.size(),
Num10msFramesPerPacket() * SamplesPer10msFrame());
const size_t max_encoded_bytes = SufficientOutputBufferSize();
EncodedInfo info;
info.encoded_bytes = encoded->AppendData(
max_encoded_bytes, [&](rtc::ArrayView<uint8_t> encoded) {
int status = WebRtcOpus_Encode(
inst_, &input_buffer_[0],
rtc::CheckedDivExact(input_buffer_.size(), config_.num_channels),
rtc::saturated_cast<int16_t>(max_encoded_bytes), encoded.data());
RTC_CHECK_GE(status, 0); // Fails only if fed invalid data.
return static_cast<size_t>(status);
});
input_buffer_.clear();
bool dtx_frame = (info.encoded_bytes <= 2);
// Will use new packet size for next encoding.
config_.frame_size_ms = next_frame_length_ms_;
if (adjust_bandwidth_ && bitrate_changed_) {
const auto bandwidth = GetNewBandwidth(config_, inst_);
if (bandwidth) {
RTC_CHECK_EQ(0, WebRtcOpus_SetBandwidth(inst_, *bandwidth));
}
bitrate_changed_ = false;
}
info.encoded_timestamp = first_timestamp_in_buffer_;
info.payload_type = payload_type_;
info.send_even_if_empty = true; // Allows Opus to send empty packets.
// After 20 DTX frames (MAX_CONSECUTIVE_DTX) Opus will send a frame
// coding the background noise. Avoid flagging this frame as speech
// (even though there is a probability of the frame being speech).
info.speech = !dtx_frame && (consecutive_dtx_frames_ != 20);
info.encoder_type = CodecType::kOpus;
// Increase or reset DTX counter.
consecutive_dtx_frames_ = (dtx_frame) ? (consecutive_dtx_frames_ + 1) : (0);
return info;
}
size_t AudioEncoderOpusImpl::Num10msFramesPerPacket() const {
return static_cast<size_t>(rtc::CheckedDivExact(config_.frame_size_ms, 10));
}
size_t AudioEncoderOpusImpl::SamplesPer10msFrame() const {
return rtc::CheckedDivExact(config_.sample_rate_hz, 100) *
config_.num_channels;
}
size_t AudioEncoderOpusImpl::SufficientOutputBufferSize() const {
// Calculate the number of bytes we expect the encoder to produce,
// then multiply by two to give a wide margin for error.
const size_t bytes_per_millisecond =
static_cast<size_t>(GetBitrateBps(config_) / (1000 * 8) + 1);
const size_t approx_encoded_bytes =
Num10msFramesPerPacket() * 10 * bytes_per_millisecond;
return 2 * approx_encoded_bytes;
}
// If the given config is OK, recreate the Opus encoder instance with those
// settings, save the config, and return true. Otherwise, do nothing and return
// false.
bool AudioEncoderOpusImpl::RecreateEncoderInstance(
const AudioEncoderOpusConfig& config) {
if (!config.IsOk())
return false;
config_ = config;
if (inst_)
RTC_CHECK_EQ(0, WebRtcOpus_EncoderFree(inst_));
input_buffer_.clear();
input_buffer_.reserve(Num10msFramesPerPacket() * SamplesPer10msFrame());
RTC_CHECK_EQ(0, WebRtcOpus_EncoderCreate(
&inst_, config.num_channels,
config.application ==
AudioEncoderOpusConfig::ApplicationMode::kVoip
? 0
: 1,
config.sample_rate_hz));
const int bitrate = GetBitrateBps(config);
RTC_CHECK_EQ(0, WebRtcOpus_SetBitRate(inst_, bitrate));
RTC_LOG(LS_VERBOSE) << "Set Opus bitrate to " << bitrate << " bps.";
if (config.fec_enabled) {
RTC_CHECK_EQ(0, WebRtcOpus_EnableFec(inst_));
} else {
RTC_CHECK_EQ(0, WebRtcOpus_DisableFec(inst_));
}
RTC_CHECK_EQ(
0, WebRtcOpus_SetMaxPlaybackRate(inst_, config.max_playback_rate_hz));
// Use the default complexity if the start bitrate is within the hysteresis
// window.
complexity_ = GetNewComplexity(config).value_or(config.complexity);
RTC_CHECK_EQ(0, WebRtcOpus_SetComplexity(inst_, complexity_));
bitrate_changed_ = true;
if (config.dtx_enabled) {
RTC_CHECK_EQ(0, WebRtcOpus_EnableDtx(inst_));
} else {
RTC_CHECK_EQ(0, WebRtcOpus_DisableDtx(inst_));
}
RTC_CHECK_EQ(0,
WebRtcOpus_SetPacketLossRate(
inst_, static_cast<int32_t>(packet_loss_rate_ * 100 + .5)));
if (config.cbr_enabled) {
RTC_CHECK_EQ(0, WebRtcOpus_EnableCbr(inst_));
} else {
RTC_CHECK_EQ(0, WebRtcOpus_DisableCbr(inst_));
}
num_channels_to_encode_ = NumChannels();
next_frame_length_ms_ = config_.frame_size_ms;
return true;
}
void AudioEncoderOpusImpl::SetFrameLength(int frame_length_ms) {
next_frame_length_ms_ = frame_length_ms;
}
void AudioEncoderOpusImpl::SetNumChannelsToEncode(
size_t num_channels_to_encode) {
RTC_DCHECK_GT(num_channels_to_encode, 0);
RTC_DCHECK_LE(num_channels_to_encode, config_.num_channels);
if (num_channels_to_encode_ == num_channels_to_encode)
return;
RTC_CHECK_EQ(0, WebRtcOpus_SetForceChannels(inst_, num_channels_to_encode));
num_channels_to_encode_ = num_channels_to_encode;
}
void AudioEncoderOpusImpl::SetProjectedPacketLossRate(float fraction) {
fraction = std::min(std::max(fraction, 0.0f), kMaxPacketLossFraction);
if (packet_loss_rate_ != fraction) {
packet_loss_rate_ = fraction;
RTC_CHECK_EQ(
0, WebRtcOpus_SetPacketLossRate(
inst_, static_cast<int32_t>(packet_loss_rate_ * 100 + .5)));
}
}
void AudioEncoderOpusImpl::SetTargetBitrate(int bits_per_second) {
const int new_bitrate = rtc::SafeClamp<int>(
bits_per_second, AudioEncoderOpusConfig::kMinBitrateBps,
AudioEncoderOpusConfig::kMaxBitrateBps);
if (config_.bitrate_bps && *config_.bitrate_bps != new_bitrate) {
config_.bitrate_bps = new_bitrate;
RTC_DCHECK(config_.IsOk());
const int bitrate = GetBitrateBps(config_);
RTC_CHECK_EQ(
0, WebRtcOpus_SetBitRate(
inst_, GetMultipliedBitrate(bitrate, bitrate_multipliers_)));
RTC_LOG(LS_VERBOSE) << "Set Opus bitrate to " << bitrate << " bps.";
bitrate_changed_ = true;
}
const auto new_complexity = GetNewComplexity(config_);
if (new_complexity && complexity_ != *new_complexity) {
complexity_ = *new_complexity;
RTC_CHECK_EQ(0, WebRtcOpus_SetComplexity(inst_, complexity_));
}
}
void AudioEncoderOpusImpl::ApplyAudioNetworkAdaptor() {
auto config = audio_network_adaptor_->GetEncoderRuntimeConfig();
if (config.bitrate_bps)
SetTargetBitrate(*config.bitrate_bps);
if (config.frame_length_ms)
SetFrameLength(*config.frame_length_ms);
if (config.enable_dtx)
SetDtx(*config.enable_dtx);
if (config.num_channels)
SetNumChannelsToEncode(*config.num_channels);
}
std::unique_ptr<AudioNetworkAdaptor>
AudioEncoderOpusImpl::DefaultAudioNetworkAdaptorCreator(
const std::string& config_string,
RtcEventLog* event_log) const {
AudioNetworkAdaptorImpl::Config config;
config.event_log = event_log;
return std::unique_ptr<AudioNetworkAdaptor>(new AudioNetworkAdaptorImpl(
config, ControllerManagerImpl::Create(
config_string, NumChannels(), supported_frame_lengths_ms(),
AudioEncoderOpusConfig::kMinBitrateBps,
num_channels_to_encode_, next_frame_length_ms_,
GetTargetBitrate(), config_.fec_enabled, GetDtx())));
}
void AudioEncoderOpusImpl::MaybeUpdateUplinkBandwidth() {
if (audio_network_adaptor_ && !use_stable_target_for_adaptation_) {
int64_t now_ms = rtc::TimeMillis();
if (!bitrate_smoother_last_update_time_ ||
now_ms - *bitrate_smoother_last_update_time_ >=
config_.uplink_bandwidth_update_interval_ms) {
absl::optional<float> smoothed_bitrate = bitrate_smoother_->GetAverage();
if (smoothed_bitrate)
audio_network_adaptor_->SetUplinkBandwidth(*smoothed_bitrate);
bitrate_smoother_last_update_time_ = now_ms;
}
}
}
ANAStats AudioEncoderOpusImpl::GetANAStats() const {
if (audio_network_adaptor_) {
return audio_network_adaptor_->GetStats();
}
return ANAStats();
}
absl::optional<std::pair<TimeDelta, TimeDelta> >
AudioEncoderOpusImpl::GetFrameLengthRange() const {
if (config_.supported_frame_lengths_ms.empty()) {
return absl::nullopt;
} else if (audio_network_adaptor_) {
return {{TimeDelta::Millis(config_.supported_frame_lengths_ms.front()),
TimeDelta::Millis(config_.supported_frame_lengths_ms.back())}};
} else {
return {{TimeDelta::Millis(config_.frame_size_ms),
TimeDelta::Millis(config_.frame_size_ms)}};
}
}
} // namespace webrtc
|
#ifndef STRING_H
#define STRING_H
#include <gdnative/string.h>
namespace godot {
class NodePath;
class Variant;
class PoolByteArray;
class PoolIntArray;
class PoolRealArray;
class PoolStringArray;
class String;
class CharString {
friend class String;
godot_char_string _char_string;
public:
~CharString();
int length() const;
const char *get_data() const;
};
class String {
godot_string _godot_string;
public:
String();
String(const char *contents);
String(const wchar_t *contents);
String(const wchar_t c);
String(const String &other);
~String();
static String num(double p_num, int p_decimals = -1);
static String num_scientific(double p_num);
static String num_real(double p_num);
static String num_int64(int64_t p_num, int base = 10, bool capitalize_hex = false);
static String chr(godot_char_type p_char);
static String md5(const uint8_t *p_md5);
static String hex_encode_buffer(const uint8_t *p_buffer, int p_len);
wchar_t &operator[](const int idx);
wchar_t operator[](const int idx) const;
void operator=(const String &s);
bool operator==(const String &s) const;
bool operator!=(const String &s) const;
String operator+(const String &s) const;
void operator+=(const String &s);
void operator+=(const wchar_t c);
bool operator<(const String &s) const;
bool operator<=(const String &s) const;
bool operator>(const String &s) const;
bool operator>=(const String &s) const;
operator NodePath() const;
int length() const;
const wchar_t *unicode_str() const;
char *alloc_c_string() const;
CharString utf8() const;
CharString ascii(bool p_extended = false) const;
bool begins_with(String &s) const;
bool begins_with_char_array(const char *p_char_array) const;
PoolStringArray bigrams() const;
String c_escape() const;
String c_unescape() const;
String capitalize() const;
bool empty() const;
bool ends_with(String &text) const;
void erase(int position, int chars);
int find(String what, int from = 0) const;
int find_last(String what) const;
int findn(String what, int from = 0) const;
String format(Variant values) const;
String format(Variant values, String placeholder) const;
String get_base_dir() const;
String get_basename() const;
String get_extension() const;
String get_file() const;
int hash() const;
int hex_to_int() const;
String insert(int position, String what) const;
bool is_abs_path() const;
bool is_rel_path() const;
bool is_subsequence_of(String text) const;
bool is_subsequence_ofi(String text) const;
bool is_valid_float() const;
bool is_valid_html_color() const;
bool is_valid_identifier() const;
bool is_valid_integer() const;
bool is_valid_ip_address() const;
String json_escape() const;
String left(int position) const;
bool match(String expr) const;
bool matchn(String expr) const;
PoolByteArray md5_buffer() const;
String md5_text() const;
int ord_at(int at) const;
String pad_decimals(int digits) const;
String pad_zeros(int digits) const;
String percent_decode() const;
String percent_encode() const;
String plus_file(String file) const;
String replace(String what, String forwhat) const;
String replacen(String what, String forwhat) const;
int rfind(String what, int from = -1) const;
int rfindn(String what, int from = -1) const;
String right(int position) const;
PoolByteArray sha256_buffer() const;
String sha256_text() const;
float similarity(String text) const;
PoolStringArray split(String divisor, bool allow_empty = true) const;
PoolIntArray split_ints(String divisor, bool allow_empty = true) const;
PoolRealArray split_floats(String divisor, bool allow_empty = true) const;
String strip_edges(bool left = true, bool right = true) const;
String substr(int from, int len) const;
float to_float() const;
int64_t to_int() const;
String to_lower() const;
String to_upper() const;
String xml_escape() const;
String xml_unescape() const;
signed char casecmp_to(String p_str) const;
signed char nocasecmp_to(String p_str) const;
signed char naturalnocasecmp_to(String p_str) const;
};
String operator+(const char *a, const String &b);
String operator+(const wchar_t *a, const String &b);
} // namespace godot
#endif // STRING_H
|
// Copyright 2019 Stellar Development Foundation and contributors. Licensed
// under the Apache License, Version 2.0. See the COPYING file at the root
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
#include "ledger/LedgerManagerImpl.h"
#include "test/TestUtils.h"
#include "test/test.h"
#include <lib/catch.hpp>
using namespace iotchain;
namespace iotchain
{
class LedgerManagerForTests : public LedgerManagerImpl
{
public:
using LedgerManagerImpl::applyBufferedLedgers;
using LedgerManagerImpl::continueCatchup;
using LedgerManagerImpl::finalizeCatchup;
using LedgerManagerImpl::initializeCatchup;
using LedgerManagerImpl::setCatchupState;
LedgerManagerForTests(Application& app) : LedgerManagerImpl(app)
{
}
bool
syncingLedgersEmpty() const
{
return mSyncingLedgers.empty();
}
void
closeLedger(LedgerCloseData const& lcd) override
{
LedgerHeader next;
next.ledgerSeq = lcd.getLedgerSeq();
advanceLedgerPointers(next);
}
};
class LedgerManagerTestApplication : public TestApplication
{
public:
LedgerManagerTestApplication(VirtualClock& clock, Config const& cfg)
: TestApplication(clock, cfg)
{
}
virtual LedgerManagerForTests&
getLedgerManager() override
{
auto& overlay = ApplicationImpl::getLedgerManager();
return static_cast<LedgerManagerForTests&>(overlay);
}
private:
virtual std::unique_ptr<LedgerManager>
createLedgerManager() override
{
return std::make_unique<LedgerManagerForTests>(*this);
}
};
}
TEST_CASE("new ledger comes from network after last applyBufferedLedgers is "
"scheduled",
"[ledger]")
{
VirtualClock clock;
auto app = createTestApplication<LedgerManagerTestApplication>(
clock, getTestConfig());
app->start();
auto ledgerCloseData = [](uint32_t ledger) {
auto txSet = std::make_shared<TxSetFrame>(Hash{});
IOTChainValue sv{txSet->getContentsHash(), 2, emptyUpgradeSteps,
IOTCHAIN_VALUE_BASIC};
return LedgerCloseData{ledger, txSet, sv};
};
auto& ledgerManager = app->getLedgerManager();
ledgerManager.initializeCatchup(ledgerCloseData(2));
ledgerManager.continueCatchup(ledgerCloseData(3));
ledgerManager.setCatchupState(
LedgerManager::CatchupState::APPLYING_BUFFERED_LEDGERS);
ledgerManager.applyBufferedLedgers();
while (clock.crank())
{
if (ledgerManager.syncingLedgersEmpty())
{
REQUIRE(ledgerManager.getCatchupState() ==
LedgerManager::CatchupState::WAITING_FOR_CLOSING_LEDGER);
break;
}
}
// there is gap, so new catchup is starting
ledgerManager.finalizeCatchup(ledgerCloseData(5));
REQUIRE(!ledgerManager.syncingLedgersEmpty());
REQUIRE(ledgerManager.getCatchupState() ==
LedgerManager::CatchupState::WAITING_FOR_TRIGGER_LEDGER);
}
|
#pragma once
#include "HotkeyCategory.hpp"
#include <QString>
#include <map>
namespace chatterino {
// ActionDefinition is an action that can be performed with a hotkey
struct ActionDefinition {
// displayName is the value that would be shown to a user when they edit or create a hotkey for an action
QString displayName;
QString argumentDescription = "";
// minCountArguments is the minimum amount of arguments the action accepts
// Example action: "Select Tab" in a popup window accepts 1 argument for which tab to select
uint8_t minCountArguments = 0;
// maxCountArguments is the maximum amount of arguments the action accepts
uint8_t maxCountArguments = minCountArguments;
};
using ActionDefinitionMap = std::map<QString, ActionDefinition>;
inline const std::map<HotkeyCategory, ActionDefinitionMap> actionNames{
{HotkeyCategory::PopupWindow,
{
{"reject", ActionDefinition{"Confirmable popups: Cancel"}},
{"accept", ActionDefinition{"Confirmable popups: Confirm"}},
{"delete", ActionDefinition{"Close"}},
{"openTab",
ActionDefinition{
"Select Tab",
"<next, previous, or index of tab to select>",
1,
}},
{"scrollPage",
ActionDefinition{
"Scroll",
"<up or down>",
1,
}},
{"search", ActionDefinition{"Focus search box"}},
}},
{HotkeyCategory::Split,
{
{"changeChannel", ActionDefinition{"Change channel"}},
{"clearMessages", ActionDefinition{"Clear messages"}},
{"createClip", ActionDefinition{"Create a clip"}},
{"delete", ActionDefinition{"Close"}},
{"focus",
ActionDefinition{
"Focus neighbouring split",
"<up, down, left, or right>",
1,
}},
{"openInBrowser", ActionDefinition{"Open channel in browser"}},
{"openInCustomPlayer",
ActionDefinition{"Open stream in custom player"}},
{"openInStreamlink", ActionDefinition{"Open stream in streamlink"}},
{"openModView", ActionDefinition{"Open mod view in browser"}},
{"openViewerList", ActionDefinition{"Open viewer list"}},
{"pickFilters", ActionDefinition{"Pick filters"}},
{"reconnect", ActionDefinition{"Reconnect to chat"}},
{"reloadEmotes",
ActionDefinition{
"Reload emotes",
"[channel or subscriber]",
0,
1,
}},
{"runCommand",
ActionDefinition{
"Run a command",
"<name of command>",
1,
}},
{"scrollPage",
ActionDefinition{
"Scroll",
"<up or down>",
1,
}},
{"scrollToBottom", ActionDefinition{"Scroll to the bottom"}},
{"setChannelNotification",
ActionDefinition{
"Set channel live notification",
"[on or off. default: toggle]",
0,
1,
}},
{"setModerationMode",
ActionDefinition{
"Set moderation mode",
"[on or off. default: toggle]",
0,
1,
}},
{"showSearch", ActionDefinition{"Search"}},
{"startWatching", ActionDefinition{"Start watching"}},
{"debug", ActionDefinition{"Show debug popup"}},
}},
{HotkeyCategory::SplitInput,
{
{"clear", ActionDefinition{"Clear message"}},
{"copy",
ActionDefinition{
"Copy",
"<source of text: split, splitInput or auto>",
1,
}},
{"cursorToStart",
ActionDefinition{
"To start of message",
"<withSelection or withoutSelection>",
1,
}},
{"cursorToEnd",
ActionDefinition{
"To end of message",
"<withSelection or withoutSelection>",
1,
}},
{"nextMessage", ActionDefinition{"Choose next sent message"}},
{"openEmotesPopup", ActionDefinition{"Open emotes list"}},
{"paste", ActionDefinition{"Paste"}},
{"previousMessage",
ActionDefinition{"Choose previously sent message"}},
{"redo", ActionDefinition{"Redo"}},
{"selectAll", ActionDefinition{"Select all"}},
{"sendMessage",
ActionDefinition{
"Send message",
"[keepInput to not clear the text after sending]",
0,
1,
}},
{"undo", ActionDefinition{"Undo"}},
}},
{HotkeyCategory::Window,
{
#ifdef C_DEBUG
{"addCheerMessage", ActionDefinition{"Debug: Add cheer test message"}},
{"addEmoteMessage", ActionDefinition{"Debug: Add emote test message"}},
{"addLinkMessage",
ActionDefinition{"Debug: Add test message with a link"}},
{"addMiscMessage", ActionDefinition{"Debug: Add misc test message"}},
{"addRewardMessage",
ActionDefinition{"Debug: Add reward test message"}},
#endif
{"moveTab",
ActionDefinition{
"Move tab",
"<next, previous, or new index of tab>",
1,
}},
{"newSplit", ActionDefinition{"Create a new split"}},
{"newTab", ActionDefinition{"Create a new tab"}},
{"openSettings", ActionDefinition{"Open settings"}},
{"openTab",
ActionDefinition{
"Select tab",
"<last, next, previous, or index of tab to select>",
1,
}},
{"openQuickSwitcher", ActionDefinition{"Open the quick switcher"}},
{"popup",
ActionDefinition{
"New popup",
"<split or window>",
1,
}},
{"quit", ActionDefinition{"Quit Chatterino"}},
{"removeTab", ActionDefinition{"Remove current tab"}},
{"reopenSplit", ActionDefinition{"Reopen closed split"}},
{"setStreamerMode",
ActionDefinition{
"Set streamer mode",
"[on, off, toggle, or auto. default: toggle]",
0,
1,
}},
{"toggleLocalR9K", ActionDefinition{"Toggle local R9K"}},
{"zoom",
ActionDefinition{
"Zoom in/out",
"<in, out, or reset>",
1,
}},
{"setTabVisibility",
ActionDefinition{
"Set tab visibility",
"[on, off, or toggle. default: toggle]",
0,
1,
}}}},
};
} // namespace chatterino
|
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2020 The PIVX developers
// Copyright (c) 2020 The CryptoDev developers
// Copyright (c) 2020 The FunCoin developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "rpc/server.h"
#include "base58.h"
#include "fs.h"
#include "init.h"
#include "main.h"
#include "random.h"
#include "sync.h"
#include "guiinterface.h"
#include "util.h"
#include "utilstrencodings.h"
#ifdef ENABLE_WALLET
#include "wallet/wallet.h"
#endif // ENABLE_WALLET
#include <boost/bind.hpp>
#include <boost/iostreams/concepts.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/signals2/signal.hpp>
#include <boost/thread.hpp>
#include <boost/algorithm/string/case_conv.hpp> // for to_upper()
#include <univalue.h>
static bool fRPCRunning = false;
static bool fRPCInWarmup = true;
static std::string rpcWarmupStatus("RPC server started");
static RecursiveMutex cs_rpcWarmup;
/* Timer-creating functions */
static RPCTimerInterface* timerInterface = NULL;
/* Map of name to timer.
* @note Can be changed to std::unique_ptr when C++11 */
static std::map<std::string, boost::shared_ptr<RPCTimerBase> > deadlineTimers;
static struct CRPCSignals
{
boost::signals2::signal<void ()> Started;
boost::signals2::signal<void ()> Stopped;
boost::signals2::signal<void (const CRPCCommand&)> PreCommand;
boost::signals2::signal<void (const CRPCCommand&)> PostCommand;
} g_rpcSignals;
void RPCServer::OnStarted(std::function<void ()> slot)
{
g_rpcSignals.Started.connect(slot);
}
void RPCServer::OnStopped(std::function<void ()> slot)
{
g_rpcSignals.Stopped.connect(slot);
}
void RPCServer::OnPreCommand(std::function<void (const CRPCCommand&)> slot)
{
g_rpcSignals.PreCommand.connect(boost::bind(slot, _1));
}
void RPCServer::OnPostCommand(std::function<void (const CRPCCommand&)> slot)
{
g_rpcSignals.PostCommand.connect(boost::bind(slot, _1));
}
void RPCTypeCheck(const UniValue& params,
const std::list<UniValue::VType>& typesExpected,
bool fAllowNull)
{
unsigned int i = 0;
for (UniValue::VType t : typesExpected) {
if (params.size() <= i)
break;
const UniValue& v = params[i];
if (!((v.type() == t) || (fAllowNull && (v.isNull())))) {
std::string err = strprintf("Expected type %s, got %s",
uvTypeName(t), uvTypeName(v.type()));
throw JSONRPCError(RPC_TYPE_ERROR, err);
}
i++;
}
}
void RPCTypeCheckObj(const UniValue& o,
const std::map<std::string, UniValue::VType>& typesExpected,
bool fAllowNull,
bool fStrict)
{
for (const PAIRTYPE(std::string, UniValue::VType)& t : typesExpected) {
const UniValue& v = find_value(o, t.first);
if (!fAllowNull && v.isNull())
throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Missing %s", t.first));
if (!((v.type() == t.second) || (fAllowNull && (v.isNull())))) {
std::string err = strprintf("Expected type %s for %s, got %s",
uvTypeName(t.second), t.first, uvTypeName(v.type()));
throw JSONRPCError(RPC_TYPE_ERROR, err);
}
}
if (fStrict) {
for (const std::string& k : o.getKeys()) {
if (typesExpected.count(k) == 0) {
std::string err = strprintf("Unexpected key %s", k);
throw JSONRPCError(RPC_TYPE_ERROR, err);
}
}
}
}
CAmount AmountFromValue(const UniValue& value)
{
if (!value.isNum() && !value.isStr())
throw JSONRPCError(RPC_TYPE_ERROR,"Amount is not a number or string");
CAmount nAmount;
if (!ParseFixedPoint(value.getValStr(), 8, &nAmount))
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount");
if (!Params().GetConsensus().MoneyRange(nAmount))
throw JSONRPCError(RPC_TYPE_ERROR, "Amount out of range");
return nAmount;
}
UniValue ValueFromAmount(const CAmount& amount)
{
bool sign = amount < 0;
int64_t n_abs = (sign ? -amount : amount);
int64_t quotient = n_abs / COIN;
int64_t remainder = n_abs % COIN;
return UniValue(UniValue::VNUM,
strprintf("%s%d.%08d", sign ? "-" : "", quotient, remainder));
}
uint256 ParseHashV(const UniValue& v, std::string strName)
{
std::string strHex;
if (v.isStr())
strHex = v.get_str();
if (!IsHex(strHex)) // Note: IsHex("") is false
throw JSONRPCError(RPC_INVALID_PARAMETER, strName + " must be hexadecimal string (not '" + strHex + "')");
if (64 != strHex.length())
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%s must be of length %d (not %d)", strName, 64, strHex.length()));
uint256 result;
result.SetHex(strHex);
return result;
}
uint256 ParseHashO(const UniValue& o, std::string strKey)
{
return ParseHashV(find_value(o, strKey), strKey);
}
std::vector<unsigned char> ParseHexV(const UniValue& v, std::string strName)
{
std::string strHex;
if (v.isStr())
strHex = v.get_str();
if (!IsHex(strHex))
throw JSONRPCError(RPC_INVALID_PARAMETER, strName + " must be hexadecimal string (not '" + strHex + "')");
return ParseHex(strHex);
}
std::vector<unsigned char> ParseHexO(const UniValue& o, std::string strKey)
{
return ParseHexV(find_value(o, strKey), strKey);
}
int ParseInt(const UniValue& o, std::string strKey)
{
const UniValue& v = find_value(o, strKey);
if (v.isNum())
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, " + strKey + "is not an int");
return v.get_int();
}
bool ParseBool(const UniValue& o, std::string strKey)
{
const UniValue& v = find_value(o, strKey);
if (v.isBool())
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, " + strKey + "is not a bool");
return v.get_bool();
}
/**
* Note: This interface may still be subject to change.
*/
std::string CRPCTable::help(std::string strCommand) const
{
std::string strRet;
std::string category;
std::set<rpcfn_type> setDone;
std::vector<std::pair<std::string, const CRPCCommand*> > vCommands;
for (std::map<std::string, const CRPCCommand*>::const_iterator mi = mapCommands.begin(); mi != mapCommands.end(); ++mi)
vCommands.push_back(std::make_pair(mi->second->category + mi->first, mi->second));
std::sort(vCommands.begin(), vCommands.end());
for (const PAIRTYPE(std::string, const CRPCCommand*) & command : vCommands) {
const CRPCCommand* pcmd = command.second;
std::string strMethod = pcmd->name;
// We already filter duplicates, but these deprecated screw up the sort order
if (strMethod.find("label") != std::string::npos)
continue;
if ((strCommand != "" || pcmd->category == "hidden") && strMethod != strCommand)
continue;
try {
UniValue params;
rpcfn_type pfn = pcmd->actor;
if (setDone.insert(pfn).second)
(*pfn)(params, true);
} catch (const std::exception& e) {
// Help text is returned in an exception
std::string strHelp = std::string(e.what());
if (strCommand == "") {
if (strHelp.find('\n') != std::string::npos)
strHelp = strHelp.substr(0, strHelp.find('\n'));
if (category != pcmd->category) {
if (!category.empty())
strRet += "\n";
category = pcmd->category;
std::string firstLetter = category.substr(0, 1);
boost::to_upper(firstLetter);
strRet += "== " + firstLetter + category.substr(1) + " ==\n";
}
}
strRet += strHelp + "\n";
}
}
if (strRet == "")
strRet = strprintf("help: unknown command: %s\n", strCommand);
strRet = strRet.substr(0, strRet.size() - 1);
return strRet;
}
UniValue help(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() > 1)
throw std::runtime_error(
"help ( \"command\" )\n"
"\nList all commands, or get help for a specified command.\n"
"\nArguments:\n"
"1. \"command\" (string, optional) The command to get help on\n"
"\nResult:\n"
"\"text\" (string) The help text\n");
std::string strCommand;
if (params.size() > 0)
strCommand = params[0].get_str();
return tableRPC.help(strCommand);
}
UniValue stop(const UniValue& params, bool fHelp)
{
// Accept the deprecated and ignored 'detach' boolean argument
if (fHelp || params.size() > 1)
throw std::runtime_error(
"stop\n"
"\nStop FUNC server.");
// Event loop will exit after current HTTP requests have been handled, so
// this reply will get back to the client.
StartShutdown();
return "FUNC server stopping";
}
/**
* Call Table
*/
static const CRPCCommand vRPCCommands[] =
{
// category name actor (function) okSafeMode
// --------------------- ------------------------ ----------------------- ----------
/* Overall control/query calls */
{"control", "getinfo", &getinfo, true }, /* uses wallet if enabled */
{"control", "help", &help, true },
{"control", "stop", &stop, true },
/* P2P networking */
{"network", "getnetworkinfo", &getnetworkinfo, true },
{"network", "addnode", &addnode, true },
{"network", "disconnectnode", &disconnectnode, true },
{"network", "getaddednodeinfo", &getaddednodeinfo, true },
{"network", "getconnectioncount", &getconnectioncount, true },
{"network", "getnettotals", &getnettotals, true },
{"network", "getpeerinfo", &getpeerinfo, true },
{"network", "ping", &ping, true },
{"network", "setban", &setban, true },
{"network", "listbanned", &listbanned, true },
{"network", "clearbanned", &clearbanned, true },
/* Block chain and UTXO */
{"blockchain", "findserial", &findserial, true },
{"blockchain", "getblockindexstats", &getblockindexstats, true },
{"blockchain", "getserials", &getserials, true },
{"blockchain", "getblockchaininfo", &getblockchaininfo, true },
{"blockchain", "getbestblockhash", &getbestblockhash, true },
{"blockchain", "getblockcount", &getblockcount, true },
{"blockchain", "getblock", &getblock, true },
{"blockchain", "getblockhash", &getblockhash, true },
{"blockchain", "getblockheader", &getblockheader, false },
{"blockchain", "getchaintips", &getchaintips, true },
{"blockchain", "getdifficulty", &getdifficulty, true },
{"blockchain", "getfeeinfo", &getfeeinfo, true },
{"blockchain", "getmempoolinfo", &getmempoolinfo, true },
{"blockchain", "getrawmempool", &getrawmempool, true },
{"blockchain", "gettxout", &gettxout, true },
{"blockchain", "gettxoutsetinfo", &gettxoutsetinfo, true },
{"blockchain", "invalidateblock", &invalidateblock, true },
{"blockchain", "reconsiderblock", &reconsiderblock, true },
{"blockchain", "verifychain", &verifychain, true },
/* Mining */
{"mining", "getblocktemplate", &getblocktemplate, true },
{"mining", "getmininginfo", &getmininginfo, true },
{"mining", "getnetworkhashps", &getnetworkhashps, true },
{"mining", "prioritisetransaction", &prioritisetransaction, true },
{"mining", "submitblock", &submitblock, true },
#ifdef ENABLE_WALLET
/* Coin generation */
{"generating", "getgenerate", &getgenerate, true },
{"generating", "gethashespersec", &gethashespersec, true },
{"generating", "setgenerate", &setgenerate, true },
{"generating", "generate", &generate, true },
#endif
/* Raw transactions */
{"rawtransactions", "createrawtransaction", &createrawtransaction, true },
{"rawtransactions", "decoderawtransaction", &decoderawtransaction, true },
{"rawtransactions", "decodescript", &decodescript, true },
{"rawtransactions", "getrawtransaction", &getrawtransaction, true },
{"rawtransactions", "fundrawtransaction", &fundrawtransaction, false},
{"rawtransactions", "sendrawtransaction", &sendrawtransaction, false },
{"rawtransactions", "signrawtransaction", &signrawtransaction, false }, /* uses wallet if enabled */
/* Utility functions */
{"util", "createmultisig", &createmultisig, true },
{"util", "logging", &logging, true },
{"util", "validateaddress", &validateaddress, true }, /* uses wallet if enabled */
{"util", "verifymessage", &verifymessage, true },
{"util", "estimatefee", &estimatefee, true },
{"util", "estimatepriority", &estimatepriority, true },
/* Not shown in help */
{"hidden", "invalidateblock", &invalidateblock, true },
{"hidden", "reconsiderblock", &reconsiderblock, true },
{"hidden", "setmocktime", &setmocktime, true },
{ "hidden", "waitfornewblock", &waitfornewblock, true },
{ "hidden", "waitforblock", &waitforblock, true },
{ "hidden", "waitforblockheight", &waitforblockheight, true },
/* FUNC features */
{"func", "listmasternodes", &listmasternodes, true },
{"func", "getmasternodecount", &getmasternodecount, true },
{"func", "createmasternodebroadcast", &createmasternodebroadcast, true },
{"func", "decodemasternodebroadcast", &decodemasternodebroadcast, true },
{"func", "relaymasternodebroadcast", &relaymasternodebroadcast, true },
{"func", "masternodecurrent", &masternodecurrent, true },
{"func", "startmasternode", &startmasternode, true },
{"func", "createmasternodekey", &createmasternodekey, true },
{"func", "getmasternodeoutputs", &getmasternodeoutputs, true },
{"func", "listmasternodeconf", &listmasternodeconf, true },
{"func", "getmasternodestatus", &getmasternodestatus, true },
{"func", "getmasternodewinners", &getmasternodewinners, true },
{"func", "getmasternodescores", &getmasternodescores, true },
{"func", "preparebudget", &preparebudget, true },
{"func", "submitbudget", &submitbudget, true },
{"func", "mnbudgetvote", &mnbudgetvote, true },
{"func", "getbudgetvotes", &getbudgetvotes, true },
{"func", "getnextsuperblock", &getnextsuperblock, true },
{"func", "getbudgetprojection", &getbudgetprojection, true },
{"func", "getbudgetinfo", &getbudgetinfo, true },
{"func", "mnbudgetrawvote", &mnbudgetrawvote, true },
{"func", "mnfinalbudget", &mnfinalbudget, true },
{"func", "checkbudgets", &checkbudgets, true },
{"func", "mnsync", &mnsync, true },
{"func", "spork", &spork, true },
#ifdef ENABLE_WALLET
/* Wallet */
{"wallet", "bip38encrypt", &bip38encrypt, true },
{"wallet", "bip38decrypt", &bip38decrypt, true },
{"wallet", "getaddressinfo", &getaddressinfo, true },
{"wallet", "getstakingstatus", &getstakingstatus, false },
{"wallet", "multisend", &multisend, false },
{"zerocoin", "createrawzerocoinspend", &createrawzerocoinspend, false },
{"zerocoin", "getzerocoinbalance", &getzerocoinbalance, false },
{"zerocoin", "listmintedzerocoins", &listmintedzerocoins, false },
{"zerocoin", "listspentzerocoins", &listspentzerocoins, false },
{"zerocoin", "listzerocoinamounts", &listzerocoinamounts, false },
{"zerocoin", "mintzerocoin", &mintzerocoin, false },
{"zerocoin", "spendzerocoin", &spendzerocoin, false },
{"zerocoin", "spendrawzerocoin", &spendrawzerocoin, true },
{"zerocoin", "spendzerocoinmints", &spendzerocoinmints, false },
{"zerocoin", "resetmintzerocoin", &resetmintzerocoin, false },
{"zerocoin", "resetspentzerocoin", &resetspentzerocoin, false },
{"zerocoin", "getarchivedzerocoin", &getarchivedzerocoin, false },
{"zerocoin", "importzerocoins", &importzerocoins, false },
{"zerocoin", "exportzerocoins", &exportzerocoins, false },
{"zerocoin", "reconsiderzerocoins", &reconsiderzerocoins, false },
{"zerocoin", "getspentzerocoinamount", &getspentzerocoinamount, false },
{"zerocoin", "getzfuncseed", &getzfuncseed, false },
{"zerocoin", "setzfuncseed", &setzfuncseed, false },
{"zerocoin", "generatemintlist", &generatemintlist, false },
{"zerocoin", "searchdzfunc", &searchdzfunc, false },
{"zerocoin", "dzfuncstate", &dzfuncstate, false },
#endif // ENABLE_WALLET
};
CRPCTable::CRPCTable()
{
unsigned int vcidx;
for (vcidx = 0; vcidx < (sizeof(vRPCCommands) / sizeof(vRPCCommands[0])); vcidx++) {
const CRPCCommand* pcmd;
pcmd = &vRPCCommands[vcidx];
mapCommands[pcmd->name] = pcmd;
}
}
const CRPCCommand *CRPCTable::operator[](const std::string &name) const
{
std::map<std::string, const CRPCCommand*>::const_iterator it = mapCommands.find(name);
if (it == mapCommands.end())
return NULL;
return (*it).second;
}
bool CRPCTable::appendCommand(const std::string& name, const CRPCCommand* pcmd)
{
if (IsRPCRunning())
return false;
// don't allow overwriting for now
std::map<std::string, const CRPCCommand*>::const_iterator it = mapCommands.find(name);
if (it != mapCommands.end())
return false;
mapCommands[name] = pcmd;
return true;
}
bool StartRPC()
{
LogPrint(BCLog::RPC, "Starting RPC\n");
fRPCRunning = true;
g_rpcSignals.Started();
return true;
}
void InterruptRPC()
{
LogPrint(BCLog::RPC, "Interrupting RPC\n");
// Interrupt e.g. running longpolls
fRPCRunning = false;
}
void StopRPC()
{
LogPrint(BCLog::RPC, "Stopping RPC\n");
deadlineTimers.clear();
g_rpcSignals.Stopped();
}
bool IsRPCRunning()
{
return fRPCRunning;
}
void SetRPCWarmupStatus(const std::string& newStatus)
{
LOCK(cs_rpcWarmup);
rpcWarmupStatus = newStatus;
}
void SetRPCWarmupFinished()
{
LOCK(cs_rpcWarmup);
assert(fRPCInWarmup);
fRPCInWarmup = false;
}
bool RPCIsInWarmup(std::string* outStatus)
{
LOCK(cs_rpcWarmup);
if (outStatus)
*outStatus = rpcWarmupStatus;
return fRPCInWarmup;
}
void JSONRequest::parse(const UniValue& valRequest)
{
// Parse request
if (!valRequest.isObject())
throw JSONRPCError(RPC_INVALID_REQUEST, "Invalid Request object");
const UniValue& request = valRequest.get_obj();
// Parse id now so errors from here on will have the id
id = find_value(request, "id");
// Parse method
UniValue valMethod = find_value(request, "method");
if (valMethod.isNull())
throw JSONRPCError(RPC_INVALID_REQUEST, "Missing method");
if (!valMethod.isStr())
throw JSONRPCError(RPC_INVALID_REQUEST, "Method must be a string");
strMethod = valMethod.get_str();
if (strMethod != "getblocktemplate")
LogPrint(BCLog::RPC, "ThreadRPCServer method=%s\n", SanitizeString(strMethod));
// Parse params
UniValue valParams = find_value(request, "params");
if (valParams.isArray())
params = valParams.get_array();
else if (valParams.isNull())
params = UniValue(UniValue::VARR);
else
throw JSONRPCError(RPC_INVALID_REQUEST, "Params must be an array");
}
static UniValue JSONRPCExecOne(const UniValue& req)
{
UniValue rpc_result(UniValue::VOBJ);
JSONRequest jreq;
try {
jreq.parse(req);
UniValue result = tableRPC.execute(jreq.strMethod, jreq.params);
rpc_result = JSONRPCReplyObj(result, NullUniValue, jreq.id);
} catch (const UniValue& objError) {
rpc_result = JSONRPCReplyObj(NullUniValue, objError, jreq.id);
} catch (const std::exception& e) {
rpc_result = JSONRPCReplyObj(NullUniValue,
JSONRPCError(RPC_PARSE_ERROR, e.what()), jreq.id);
}
return rpc_result;
}
std::string JSONRPCExecBatch(const UniValue& vReq)
{
UniValue ret(UniValue::VARR);
for (unsigned int reqIdx = 0; reqIdx < vReq.size(); reqIdx++)
ret.push_back(JSONRPCExecOne(vReq[reqIdx]));
return ret.write() + "\n";
}
UniValue CRPCTable::execute(const std::string &strMethod, const UniValue ¶ms) const
{
// Find method
const CRPCCommand* pcmd = tableRPC[strMethod];
if (!pcmd)
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found");
g_rpcSignals.PreCommand(*pcmd);
try {
// Execute
return pcmd->actor(params, false);
} catch (const std::exception& e) {
throw JSONRPCError(RPC_MISC_ERROR, e.what());
}
g_rpcSignals.PostCommand(*pcmd);
}
std::vector<std::string> CRPCTable::listCommands() const
{
std::vector<std::string> commandList;
typedef std::map<std::string, const CRPCCommand*> commandMap;
std::transform( mapCommands.begin(), mapCommands.end(),
std::back_inserter(commandList),
boost::bind(&commandMap::value_type::first,_1) );
return commandList;
}
std::string HelpExampleCli(std::string methodname, std::string args)
{
return "> func-cli " + methodname + " " + args + "\n";
}
std::string HelpExampleRpc(std::string methodname, std::string args)
{
return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", "
"\"method\": \"" +
methodname + "\", \"params\": [" + args + "] }' -H 'content-type: text/plain;' http://127.0.0.1:12281/\n";
}
void RPCSetTimerInterfaceIfUnset(RPCTimerInterface *iface)
{
if (!timerInterface)
timerInterface = iface;
}
void RPCSetTimerInterface(RPCTimerInterface *iface)
{
timerInterface = iface;
}
void RPCUnsetTimerInterface(RPCTimerInterface *iface)
{
if (timerInterface == iface)
timerInterface = NULL;
}
void RPCRunLater(const std::string& name, std::function<void(void)> func, int64_t nSeconds)
{
if (!timerInterface)
throw JSONRPCError(RPC_INTERNAL_ERROR, "No timer handler registered for RPC");
deadlineTimers.erase(name);
LogPrint(BCLog::RPC, "queue run of timer %s in %i seconds (using %s)\n", name, nSeconds, timerInterface->Name());
deadlineTimers.insert(std::make_pair(name, boost::shared_ptr<RPCTimerBase>(timerInterface->NewTimer(func, nSeconds*1000))));
}
CRPCTable tableRPC;
|
#include "shellprv.h"
#pragma hdrstop
#include "ids.h"
#include "mtptl.h"
#include "hwcmmn.h"
#include "datautil.h"
// for now
#include "mixctnt.h"
#include "filetbl.h"
#include "apprmdlg.h"
#include "views.h"
#include <ddraw.h>
CDPA<PNPNOTIFENTRY> CSniffDrive::_dpaNotifs = NULL;
HANDLE CSniffDrive::_hThreadSCN = NULL;
HWND CSniffDrive::_hwndNotify = NULL;
//
// if a drive has a AutoRun.inf file and AutoRun is not restricted in
// the registry. copy the AutoRun info into a key in the registry.
//
// HKEY_CLASSES_ROOT\AutoRun\0 (0=A,1=B,...)
//
// the key is a standard ProgID key, has DefaultIcon, shell, shellex, ...
//
// the autorun file looks like this....
//
// [AutoRun]
// key = value
// key = value
// key = value
//
// examples:
//
// [AutoRun]
// DefaultIcon = foo.exe,1
// shell=myverb
// shell\myverb = &MyVerb
// shell\myverb\command = myexe.exe
//
// will give the drive a icon from 'foo.exe'
// add a verb called myverb (with name "&My Verb")
// and make myverb default.
//
// [AutoRun]
// shell\myverb = &MyVerb
// shell\myverb\command = myexe.exe
//
// add a verb called myverb (with name "&My Verb")
// verb will not be default.
//
// any thing they add will be copied over, they can add wacky things
// like CLSID's or shellx\ContextMenuHandlers and it will work.
//
// or they can just copy over data the app will look at later.
//
// the following special cases will be supported....
//
// [AutoRun]
// Open = command.exe /params
// Icon = iconfile, iconnumber
//
// will be treated like:
//
// [AutoRun]
// DefaultIcon = iconfile, iconnumber
// shell = AutoRun
// shell\AutoRun = Auto&Play
// shell\AutoRun\command = command.exe /params
//
//
// This function tries to take care of the case that a command was registered
// in the autrun file of a cdrom. If the command is relative than see if the
// command exists on the CDROM
void CMountPoint::_QualifyCommandToDrive(LPTSTR pszCommand, DWORD cchCommand)
{
// for now we assume that we'll call this only for CD mounted on a drive letter
// (by oppoition to a folder)
if (_IsMountedOnDriveLetter())
{
TCHAR szImage[MAX_PATH];
StringCchCopy(szImage, ARRAYSIZE(szImage), pszCommand);
PathRemoveArgs(szImage);
PathUnquoteSpaces(szImage);
if (PathIsRelative(szImage))
{
TCHAR szFinal[MAX_PATH];
LPTSTR pszTmp = szImage;
StringCchCopy(szFinal, ARRAYSIZE(szFinal), _GetName());
// do simple check for command, check for "..\abc" or "../abc"
while ((TEXT('.') == *pszTmp) && (TEXT('.') == *(pszTmp + 1)) &&
((TEXT('\\') == *(pszTmp + 2)) || (TEXT('/') == *(pszTmp + 2))))
{
pszTmp += 3;
}
StringCchCat(szFinal, ARRAYSIZE(szFinal), pszTmp);
// we first check if it exists on the CD
DWORD dwAttrib = GetFileAttributes(szFinal);
if (0xFFFFFFFF == dwAttrib)
{
// It's not on the CD, try appending ".exe"
StringCchCat(szFinal, ARRAYSIZE(szFinal), TEXT(".exe"));
dwAttrib = GetFileAttributes(szFinal);
}
if (0xFFFFFFFF != dwAttrib)
{
// Yes, it's on the CD
PathQuoteSpaces(szFinal);
LPTSTR pszArgs = PathGetArgs(pszCommand);
if (pszArgs && *pszArgs)
{
StringCchCat(szFinal, ARRAYSIZE(szFinal), pszArgs - 1);
}
StringCchCopy(pszCommand, cchCommand, szFinal);
}
else
{
// No, not on the CD
}
}
}
}
// This one does not hit the drive
BOOL CMountPoint::_IsAutoRunDrive()
{
BOOL fRet = TRUE;
// Add support for now drive letter
if (_IsMountedOnDriveLetter())
{
int iDrive = DRIVEID(_GetName());
// Restrict auto-run's to particular drives.
if (SHRestricted(REST_NODRIVEAUTORUN) & (1 << iDrive))
{
fRet = FALSE;
}
}
if (fRet)
{
UINT uDriveType = _GetDriveType();
// Restrict auto-run's to particular types of drives.
if (SHRestricted(REST_NODRIVETYPEAUTORUN) & (1 << (uDriveType & DRIVE_TYPE)))
{
fRet = FALSE;
}
else
{
if (DRIVE_UNKNOWN == (uDriveType & DRIVE_TYPE))
{
fRet = FALSE;
}
}
if (fRet && _IsFloppy())
{
fRet = FALSE;
}
}
return fRet;
}
HRESULT CMountPoint::_AddAutoplayVerb()
{
HRESULT hr = E_FAIL;
if (RSSetTextValue(TEXT("shell\\Autoplay\\DropTarget"), TEXT("CLSID"),
TEXT("{f26a669a-bcbb-4e37-abf9-7325da15f931}"), REG_OPTION_NON_VOLATILE))
{
// IDS_MENUAUTORUN -> 8504
if (RSSetTextValue(TEXT("shell\\Autoplay"), TEXT("MUIVerb"),
TEXT("@shell32.dll,-8504"), REG_OPTION_NON_VOLATILE))
{
if (RSSetTextValue(TEXT("shell"), NULL, TEXT("None"), REG_OPTION_NON_VOLATILE))
{
hr = S_OK;
}
}
}
return hr;
}
HRESULT CMountPoint::_CopyInvokeVerbKey(LPCWSTR pszProgID, LPCWSTR pszVerb)
{
ASSERT(pszProgID);
ASSERT(pszVerb);
WCHAR szKey[MAX_PATH];
HRESULT hr = E_FAIL;
hr = StringCchPrintf(szKey, ARRAYSIZE(szKey), TEXT("shell\\%s"), pszVerb);
if (SUCCEEDED(hr))
{
hr = E_FAIL;
HKEY hkeyNew = RSDuplicateSubKey(szKey, TRUE, FALSE);
if (hkeyNew)
{
hr = StringCchPrintf(szKey, ARRAYSIZE(szKey), TEXT("%s\\shell\\%s"), pszProgID, pszVerb);
if (SUCCEEDED(hr))
{
hr = E_FAIL;
if (ERROR_SUCCESS == SHCopyKey(HKEY_CLASSES_ROOT, szKey, hkeyNew, 0))
{
if (RSSetTextValue(TEXT("shell"), NULL, pszVerb, REG_OPTION_NON_VOLATILE))
{
hr = S_OK;
}
}
}
RegCloseKey(hkeyNew);
}
}
return hr;
}
BOOL CMountPoint::_ProcessAutoRunFile()
{
BOOL fRet = TRUE;
if (!_fAutorunFileProcessed)
{
BOOL fProcessFile = FALSE;
if (_IsCDROM())
{
CMtPtLocal* pmtptlocal = (CMtPtLocal*)this;
// not CDs with no media, or no autorun.inf files
if (pmtptlocal->_IsMediaPresent())
{
if (!pmtptlocal->_CanUseVolume())
{
fProcessFile = TRUE;
}
else
{
if ((HWDMC_HASAUTORUNINF & pmtptlocal->_pvol->dwMediaCap) &&
!(HWDMC_HASUSEAUTOPLAY & pmtptlocal->_pvol->dwMediaCap))
{
fProcessFile = TRUE;
}
}
}
}
else
{
if (_IsRemote())
{
fProcessFile = TRUE;
}
else
{
if (_IsFixedDisk())
{
fProcessFile = TRUE;
}
}
}
if (fProcessFile)
{
LPCTSTR pszSection;
TCHAR szInfFile[MAX_PATH];
TCHAR szKeys[512];
TCHAR szValue[MAX_PATH];
TCHAR szIcon[MAX_PATH + 12]; // MAX_PATH + room for ",1000000000" (for icon index part)
LPTSTR pszKey;
int iDrive = 0;
RSDeleteSubKey(TEXT("Shell"));
if (_IsMountedOnDriveLetter())
{
iDrive = DRIVEID(_GetName());
}
// build abs path to AutoRun.inf
StringCchCopy(szInfFile, ARRAYSIZE(szInfFile), _GetName());
StringCchCat(szInfFile, ARRAYSIZE(szInfFile), TEXT("AutoRun.inf"));
#if defined(_X86_)
pszSection = TEXT("AutoRun.x86");
#elif defined(_IA64_)
pszSection = TEXT("AutoRun.Ia64");
#elif defined(_AMD64_)
pszSection = TEXT("AutoRun.Amd64");
#endif
//
// make sure a file exists before calling GetPrivateProfileString
// because for some media this check might take a long long time
// and we dont want to have kernel wait wiht the Win16Lock
//
UINT err = SetErrorMode(SEM_FAILCRITICALERRORS);
if (!PathFileExistsAndAttributes(szInfFile, NULL))
{
SetErrorMode(err);
_fAutorunFileProcessed = TRUE;
return FALSE;
}
//
// get all the keys in the [AutoRun] section
//
// Flush the INI cache, or this may fail during a Device broadcast
WritePrivateProfileString(NULL, NULL, NULL, szInfFile);
#if defined(_X86_)
pszSection = TEXT("AutoRun.x86");
#elif defined(_IA64_)
pszSection = TEXT("AutoRun.Ia64");
#endif
int i = GetPrivateProfileString(pszSection, NULL, c_szNULL, szKeys, ARRAYSIZE(szKeys), szInfFile);
// if we fail to find a platform-specific AutoRun section, fall
// back to looking for the naked "AutoRun" section.
if (0 == i)
{
pszSection = TEXT("AutoRun");
i = GetPrivateProfileString(pszSection, NULL, c_szNULL, szKeys, ARRAYSIZE(szKeys), szInfFile);
}
SetErrorMode(err);
if (i >= 4)
{
//
// make sure the external strings are what we think.
//
ASSERT(lstrcmpi(c_szOpen,TEXT("open")) == 0);
ASSERT(lstrcmpi(c_szShell, TEXT("shell")) == 0);
// now walk all the keys in the .inf file and copy them to the registry.
for (pszKey = szKeys; *pszKey; pszKey += lstrlen(pszKey) + 1)
{
GetPrivateProfileString(pszSection, pszKey,
c_szNULL, szValue, ARRAYSIZE(szValue), szInfFile);
//
// special case open =
//
if (lstrcmpi(pszKey, c_szOpen) == 0)
{
if (_IsMountedOnDriveLetter())
{
RSSetTextValue(c_szShell, NULL, TEXT("AutoRun"));
_QualifyCommandToDrive(szValue, ARRAYSIZE(szValue));
RSSetTextValue(TEXT("shell\\AutoRun\\command"), NULL, szValue);
LoadString(HINST_THISDLL, IDS_MENUAUTORUN, szValue, ARRAYSIZE(szValue));
RSSetTextValue(TEXT("shell\\AutoRun"), NULL, szValue);
}
}
//
// special case ShellExecute
//
else if (lstrcmpi(pszKey, TEXT("ShellExecute")) == 0)
{
if (_IsMountedOnDriveLetter())
{
TCHAR szPath[MAX_PATH * 2];
if (ExpandEnvironmentStrings(
TEXT("%windir%\\system32\\RunDLL32.EXE Shell32.DLL,ShellExec_RunDLL "),
szPath, ARRAYSIZE(szPath)))
{
StringCchCat(szPath, ARRAYSIZE(szPath), szValue);
RSSetTextValue(c_szShell, NULL, TEXT("AutoRun"));
RSSetTextValue(TEXT("shell\\AutoRun\\command"), NULL, szPath);
LoadString(HINST_THISDLL, IDS_MENUAUTORUN, szValue, ARRAYSIZE(szValue));
RSSetTextValue(TEXT("shell\\AutoRun"), NULL, szValue);
}
}
}
//
// special case icon =
// make sure the icon file has a full path...
//
else if (lstrcmpi(pszKey, TEXT("Icon")) == 0)
{
StringCchCopy(szIcon, ARRAYSIZE(szIcon), _GetName());
StringCchCat(szIcon, ARRAYSIZE(szIcon), szValue);
RSSetTextValue(TEXT("_Autorun\\DefaultIcon"), NULL, szIcon);
}
//
// special case label =
// make sure the label file has a full path...
//
else if (lstrcmpi(pszKey, TEXT("Label")) == 0)
{
RSSetTextValue(TEXT("_Autorun\\DefaultLabel"), NULL, szValue);
}
//
// special case shell = open
// We have an autorun file but this puts open as the default verb
// so we force it to be Autorun
//
else if (!lstrcmpi(pszKey, TEXT("shell")) && !lstrcmpi(szValue, TEXT("open")))
{
if (_IsMountedOnDriveLetter())
{
RSSetTextValue(pszKey, NULL, TEXT("Autorun"));
}
}
//
// it is just a key/value pair copy it over.
//
else
{
if (_IsMountedOnDriveLetter())
{
if (lstrcmpi(PathFindFileName(pszKey), c_szCommand) == 0)
{
_QualifyCommandToDrive(szValue, ARRAYSIZE(szValue));
}
RSSetTextValue(pszKey, NULL, szValue);
}
}
}
}
else
{
fRet = FALSE;
}
}
_fAutorunFileProcessed = TRUE;
}
return fRet;
}
// sends the "QueryCancelAutoPlay" msg to the window to see if it wants
// to cancel the autoplay. useful for dialogs that are prompting for disk
// inserts or cases where the app wants to capture the event and not let
// other apps be run
// static
BOOL CMountPoint::_AppAllowsAutoRun(HWND hwndApp, CMountPoint* pmtpt)
{
ULONG_PTR dwCancel = 0;
DWORD dwType = pmtpt->_GetAutorunContentType();
WCHAR cDrive = pmtpt->_GetNameFirstCharUCase();
int iDrive = cDrive - TEXT('A');
SendMessageTimeout(hwndApp, QueryCancelAutoPlayMsg(), iDrive, dwType, SMTO_NORMAL | SMTO_ABORTIFHUNG,
1000, &dwCancel);
return (dwCancel == 0);
}
STDAPI SHCreateQueryCancelAutoPlayMoniker(IMoniker** ppmoniker)
{
return CreateClassMoniker(CLSID_QueryCancelAutoPlay, ppmoniker);
}
struct QUERRYRUNNINGOBJECTSTRUCT
{
WCHAR szMountPoint[MAX_PATH];
DWORD dwContentType;
WCHAR szLabel[MAX_LABEL];
DWORD dwSerialNumber;
};
DWORD WINAPI _QueryRunningObjectThreadProc(void* pv)
{
QUERRYRUNNINGOBJECTSTRUCT* pqro = (QUERRYRUNNINGOBJECTSTRUCT*)pv;
HRESULT hrRet = S_OK;
HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED);
if (SUCCEEDED(hr))
{
IRunningObjectTable* prot;
hr = GetRunningObjectTable(0, &prot);
if (SUCCEEDED(hr))
{
IMoniker* pmoniker;
IBindCtx* pbindctx;
hr = CreateBindCtx(0, &pbindctx);
if (SUCCEEDED(hr))
{
BIND_OPTS2 bindopts;
ZeroMemory(&bindopts, sizeof(bindopts));
bindopts.cbStruct = sizeof(bindopts);
bindopts.dwClassContext = CLSCTX_LOCAL_SERVER | CLSCTX_NO_CODE_DOWNLOAD;
hr = pbindctx->SetBindOptions(&bindopts);
if (SUCCEEDED(hr))
{
HKEY hkey;
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE,
TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\CancelAutoplay\\CLSID"),
0, MAXIMUM_ALLOWED, &hkey))
{
DWORD dwIndex = 0;
WCHAR szCLSID[39] = TEXT("{");
DWORD cchCLSID = ARRAYSIZE(szCLSID) - 1;
while ((S_FALSE != hrRet) &&
(ERROR_SUCCESS == RegEnumValue(hkey, dwIndex, &(szCLSID[1]),
&cchCLSID, 0, 0, 0, 0)))
{
CLSID clsid;
szCLSID[37] = TEXT('}');
szCLSID[38] = 0;
hr = CLSIDFromString(szCLSID, &clsid);
if (SUCCEEDED(hr))
{
IMoniker* pmoniker;
// Create the moniker that we'll put in the ROT
hr = CreateClassMoniker(clsid, &pmoniker);
if (SUCCEEDED(hr))
{
IUnknown* punk;
hr = prot->GetObject(pmoniker, &punk);
if (SUCCEEDED(hr) && (S_FALSE != hr))
{
IQueryCancelAutoPlay* pqca;
hr = punk->QueryInterface(IID_PPV_ARG(IQueryCancelAutoPlay, &pqca));
if (SUCCEEDED(hr))
{
hrRet = pqca->AllowAutoPlay(pqro->szMountPoint, pqro->dwContentType,
pqro->szLabel, pqro->dwSerialNumber);
pqca->Release();
}
punk->Release();
}
pmoniker->Release();
}
}
++dwIndex;
cchCLSID = ARRAYSIZE(szCLSID) - 1;
}
RegCloseKey(hkey);
}
}
pbindctx->Release();
}
if (S_FALSE != hrRet)
{
// This case is to support WMP and CD burning. We did not get to replace
// their cancel logic before shipping.
hr = SHCreateQueryCancelAutoPlayMoniker(&pmoniker);
if (SUCCEEDED(hr))
{
IUnknown* punk;
hr = prot->GetObject(pmoniker, &punk);
if (SUCCEEDED(hr) && (S_FALSE != hr))
{
IQueryCancelAutoPlay* pqca;
hr = punk->QueryInterface(IID_PPV_ARG(IQueryCancelAutoPlay, &pqca));
if (SUCCEEDED(hr))
{
hrRet = pqca->AllowAutoPlay(pqro->szMountPoint, pqro->dwContentType,
pqro->szLabel, pqro->dwSerialNumber);
pqca->Release();
}
punk->Release();
}
pmoniker->Release();
}
}
prot->Release();
}
CoUninitialize();
}
LocalFree((HLOCAL)pqro);
return (DWORD)hrRet;
}
// static
HRESULT CMountPoint::_QueryRunningObject(CMountPoint* pmtpt, DWORD dwAutorunContentType, BOOL* pfAllow)
{
*pfAllow = TRUE;
QUERRYRUNNINGOBJECTSTRUCT *pqro;
HRESULT hr = SHLocalAlloc(sizeof(*pqro), &pqro);
if (SUCCEEDED(hr))
{
WCHAR szLabel[MAX_LABEL];
if (!(ARCONTENT_BLANKCD & dwAutorunContentType) &&
!(ARCONTENT_BLANKDVD & dwAutorunContentType))
{
if (pmtpt->_GetGVILabel(szLabel, ARRAYSIZE(szLabel)))
{
StringCchCopy(pqro->szLabel, ARRAYSIZE(pqro->szLabel), szLabel);
pmtpt->_GetSerialNumber(&(pqro->dwSerialNumber));
}
}
hr = StringCchCopy(pqro->szMountPoint, ARRAYSIZE(pqro->szMountPoint), pmtpt->_GetName());
if (SUCCEEDED(hr))
{
pqro->dwContentType = dwAutorunContentType;
HANDLE hThread = CreateThread(NULL, 0, _QueryRunningObjectThreadProc,
pqro, 0, NULL);
if (hThread)
{
// thread now owns these guys, NULL them out to avoid dbl free
pqro = NULL; // don't free this below
hr = S_FALSE;
// Wait 3 sec to see if wants to process it. If not, it's
// fair play for us.
DWORD dwWait = WaitForSingleObject(hThread, 3000);
if (WAIT_OBJECT_0 == dwWait)
{
// Return within time and did not failed
DWORD dwExitCode;
if (GetExitCodeThread(hThread, &dwExitCode))
{
HRESULT hrHandlesEvent = (HRESULT)dwExitCode;
// Will return S_FALSE if they do NOT allow AutoRun
if (SUCCEEDED(hrHandlesEvent) && (S_FALSE == hrHandlesEvent))
{
*pfAllow = FALSE;
}
hr = S_OK;
}
}
CloseHandle(hThread);
}
else
{
hr = E_OUTOFMEMORY;
}
}
LocalFree((HLOCAL)pqro); // may be NULL
}
return hr;
}
CAutoPlayParams::CAutoPlayParams(LPCWSTR pszDrive, CMountPoint* pMtPt, DWORD dwAutorunFlags)
: _pszDrive(pszDrive),
_pmtpt(pMtPt),
_dwAutorunFlags(dwAutorunFlags),
_state(APS_RESET),
_pdo(NULL),
_fCheckAlwaysDoThisCheckBox(FALSE)
{
_dwDriveType = pMtPt->_GetMTPTDriveType();
_dwContentType = pMtPt->_GetMTPTContentType();
if (DT_ANYLOCALDRIVES & _dwDriveType)
_pmtptl = (CMtPtLocal*)pMtPt;
else
_pmtptl = NULL;
// maybe assert on these?
}
BOOL CAutoPlayParams::_ShouldSniffDrive(BOOL fCheckHandlerDefaults)
{
BOOL fSniff = FALSE;
if (_pmtptl)
{
if (CT_AUTORUNINF & _dwContentType)
{
if (_pmtptl->_CanUseVolume())
{
if (_pmtptl->_pvol->dwMediaCap & HWDMC_HASUSEAUTOPLAY)
{
fSniff = TRUE;
}
}
}
else
{
fSniff = TRUE;
}
if (fSniff)
{
fSniff = FALSE;
if (!((CT_CDAUDIO | CT_DVDMOVIE) & _dwContentType))
{
if (_pmtptl->_CanUseVolume())
{
if (!(HWDVF_STATE_HASAUTOPLAYHANDLER & _pmtptl->_pvol->dwVolumeFlags) &&
!(HWDVF_STATE_DONOTSNIFFCONTENT & _pmtptl->_pvol->dwVolumeFlags))
{
if (AUTORUNFLAG_MENUINVOKED & _dwAutorunFlags)
{
fSniff = TRUE;
}
else if (DT_FIXEDDISK & _dwDriveType)
{
if (HWDDC_REMOVABLEDEVICE & _pmtptl->_pvol->dwDriveCapability)
{
fSniff = TRUE;
}
}
else
{
if (AUTORUNFLAG_MEDIAARRIVAL & _dwAutorunFlags)
{
fSniff = TRUE;
}
else
{
if (AUTORUNFLAG_MTPTARRIVAL & _dwAutorunFlags)
{
if (HWDDC_REMOVABLEDEVICE & _pmtptl->_pvol->dwDriveCapability)
{
fSniff = TRUE;
}
}
}
}
}
}
}
}
}
if (fSniff && fCheckHandlerDefaults)
{
// Let's make sure the user did not pick "Take no action" for all Autoplay
// content types, it would be useless to sniff.
BOOL fAllTakeNoAction = TRUE;
DWORD rgdwContentType[] =
{
CT_AUTOPLAYMUSIC,
CT_AUTOPLAYPIX,
CT_AUTOPLAYMOVIE,
CT_AUTOPLAYMUSIC | CT_AUTOPLAYPIX | CT_AUTOPLAYMOVIE, // Mix content
};
for (DWORD dw = 0; fAllTakeNoAction && (dw < ARRAYSIZE(rgdwContentType)); ++dw)
{
WCHAR szContentTypeHandler[MAX_CONTENTTYPEHANDLER];
DWORD dwMtPtContentType = rgdwContentType[dw];
HRESULT hr = _GetContentTypeHandler(dwMtPtContentType, szContentTypeHandler, ARRAYSIZE(szContentTypeHandler));
if (SUCCEEDED(hr))
{
IAutoplayHandler* piah;
hr = _GetAutoplayHandler(Drive(), TEXT("ContentArrival"), szContentTypeHandler, &piah);
if (SUCCEEDED(hr))
{
LPWSTR pszHandlerDefault;
hr = piah->GetDefaultHandler(&pszHandlerDefault);
if (SUCCEEDED(hr))
{
if (HANDLERDEFAULT_MORERECENTHANDLERSINSTALLED &
HANDLERDEFAULT_GETFLAGS(hr))
{
fAllTakeNoAction = FALSE;
}
else
{
if (lstrcmpi(pszHandlerDefault, TEXT("MSTakeNoAction")))
{
fAllTakeNoAction = FALSE;
}
}
CoTaskMemFree(pszHandlerDefault);
}
piah->Release();
}
}
}
if (fAllTakeNoAction)
{
fSniff = FALSE;
}
}
return fSniff;
}
DWORD CAutoPlayParams::ContentType()
{
return _dwContentType;
}
HRESULT CAutoPlayParams::_InitObjects(IShellFolder **ppsf)
{
HRESULT hr;
if (!_pdo || ppsf)
{
LPITEMIDLIST pidlFolder;
hr = SHParseDisplayName(_pszDrive, NULL, &pidlFolder, 0, NULL);
if (SUCCEEDED(hr))
{
hr = SHGetUIObjectOf(pidlFolder, NULL, IID_PPV_ARG(IDataObject, &_pdo));
ILFree(pidlFolder);
}
}
else
{
hr = S_OK;
}
if (SUCCEEDED(hr) && ppsf)
{
// we need to avoid hitting the burn folder
// so we skip junctions for the sniff
IBindCtx * pbc;
hr = SHCreateSkipBindCtx(NULL, &pbc);
if (SUCCEEDED(hr))
{
LPITEMIDLIST pidlFolder;
hr = SHParseDisplayName(_pszDrive, pbc, &pidlFolder, 0, NULL);
if (SUCCEEDED(hr))
{
hr = SHBindToObjectEx(NULL, pidlFolder, pbc, IID_PPV_ARG(IShellFolder, ppsf));
ILFree(pidlFolder);
}
pbc->Release();
}
}
return hr;
}
HRESULT CAutoPlayParams::_AddWalkToDataObject(INamespaceWalk* pnsw)
{
UINT cidl;
LPITEMIDLIST *apidl;
HRESULT hr = pnsw->GetIDArrayResult(&cidl, &apidl);
if (SUCCEEDED(hr))
{
// we need to add this back in
if (cidl)
{
// ragged array
HIDA hida = HIDA_Create(&c_idlDesktop, cidl, (LPCITEMIDLIST *)apidl);
if (hida)
{
IDLData_InitializeClipboardFormats(); // init our registerd formats
// should we free hida on FAILED?
DataObj_SetGlobal(_pdo, g_cfAutoPlayHIDA, hida);
}
}
FreeIDListArray(apidl, cidl);
}
return hr;
}
HRESULT CAutoPlayParams::_Sniff(DWORD *pdwFound)
{
// we found nothing
HRESULT hr = S_FALSE;
*pdwFound = 0;
if (_pmtptl->_CanUseVolume())
{
// setup the IDataObject and IShellFolder for the walk
IShellFolder *psf;
HRESULT hr = _InitObjects(&psf);
if (SUCCEEDED(hr))
{
INamespaceWalk* pnsw;
hr = CoCreateInstance(CLSID_NamespaceWalker, NULL, CLSCTX_INPROC, IID_PPV_ARG(INamespaceWalk, &pnsw));
if (SUCCEEDED(hr))
{
CSniffDrive sniff;
hr = sniff.RegisterForNotifs(_pmtptl->_pvol->pszDeviceIDVolume);
if (SUCCEEDED(hr))
{
// We don't care about the return value. WE don't want to stop Autorun for as much.
// If sniffing fail we go on with what we have.
if (SUCCEEDED(pnsw->Walk(psf, NSWF_IGNORE_AUTOPLAY_HIDA | NSWF_DONT_TRAVERSE_LINKS | NSWF_SHOW_PROGRESS, 4, &sniff)))
{
// we keep everything we found
_AddWalkToDataObject(pnsw);
}
sniff.UnregisterForNotifs();
*pdwFound = sniff.Found();
}
pnsw->Release();
}
psf->Release();
}
}
return hr;
}
// BEGIN: Fcts for matrix below
//
BOOL CMountPoint::_acShiftKeyDown(HWND , CAutoPlayParams *)
{
return (GetAsyncKeyState(VK_SHIFT) < 0);
}
BOOL _IsDirectXExclusiveMode()
{
BOOL fRet = FALSE;
// This code determines whether a DirectDraw 7 process (game) is running and
// whether it's exclusively holding the video to the machine in full screen mode.
// The code is probably to be considered untrusted and hence is wrapped in a
// __try / __except block. It could AV and therefore bring down shell
// with it. Not very good. If the code does raise an exception the release
// call is skipped. Tough. Don't trust the release method either.
IDirectDraw7 *pIDirectDraw7 = NULL;
HRESULT hr = CoCreateInstance(CLSID_DirectDraw7, NULL, CLSCTX_INPROC_SERVER,
IID_IDirectDraw7, (void**)&pIDirectDraw7);
if (SUCCEEDED(hr))
{
ASSERT(pIDirectDraw7);
__try
{
hr = IDirectDraw7_Initialize(pIDirectDraw7, NULL);
if (DD_OK == hr)
{
fRet = (IDirectDraw7_TestCooperativeLevel(pIDirectDraw7) ==
DDERR_EXCLUSIVEMODEALREADYSET);
}
IDirectDraw7_Release(pIDirectDraw7);
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
}
}
return fRet;
}
// From a mail regarding the DirectX fct below:
//
// You can definitely count on the following:
//
// (1) If shadow cursors are on, there is definitely not an exclusive mode app running.
// (2) If hot tracking is on, there is definitely not an exclusive mode app running.
// (3) If message boxes for SEM_NOGPFAULTERRORBOX, SEM_FAILCRITICALERRORS, or
// SEM_NOOPENFILEERRORBOX have not been disabled via SetErrorMode, then there
// is definitely not an exclusive mode app running.
//
// Note: we cannot use (3) since this is per-process.
BOOL CMountPoint::_acDirectXAppRunningFullScreen(HWND hwndForeground, CAutoPlayParams *)
{
BOOL fRet = FALSE;
BOOL fSPI;
if (SystemParametersInfo(SPI_GETCURSORSHADOW, 0, &fSPI, 0) && !fSPI)
{
if (SystemParametersInfo(SPI_GETHOTTRACKING, 0, &fSPI, 0) && !fSPI)
{
// There's a chance that a DirectX app is running full screen. Let's do the
// expensive DirectX calls that will tell us for sure.
fRet = _IsDirectXExclusiveMode();
}
}
return fRet;
}
BOOL CMountPoint::_acCurrentDesktopIsActiveConsole(HWND , CAutoPlayParams *)
{
BOOL fRetValue = FALSE; // block auto-run/auto-play if we can't determine our state.
if (0 == GetSystemMetrics(SM_REMOTESESSION))
{
//
// We are not remoted. See if we are the active console session.
//
BOOL b;
DWORD dwProcessSession;
b = ProcessIdToSessionId(GetCurrentProcessId(), &dwProcessSession);
if (b)
{
DWORD dwConsoleSession = WTSGetActiveConsoleSessionId( );
if ( dwProcessSession == dwConsoleSession )
{
//
// See if the screen saver is running.
//
BOOL b;
BOOL fScreenSaver;
b = SystemParametersInfo( SPI_GETSCREENSAVERRUNNING, 0, &fScreenSaver, 0 );
if (b)
{
if (!fScreenSaver)
{
//
// We made it here, we must be the active console session without a
// screen saver.
//
HDESK hDesk = OpenInputDesktop( 0, FALSE, DESKTOP_CREATEWINDOW );
if ( NULL != hDesk )
{
//
// We have access to the current desktop which should indicate that
// WinLogon isn't.
//
CloseDesktop( hDesk );
fRetValue = TRUE;
}
// else "WinLogon" has the "desktop"... don't allow auto-run/auto-play.
}
// else a screen saver is running... don't allow auto-run/auto-play.
}
// else we are in an undeterminate state... don't allow auto-run/auto-play.
}
// else we aren't the console... don't allow auto-run/auto-play
}
// else we are in an undeterminate state... don't allow auto-run/auto-play.
}
// else we are remoted... don't allow auto-run/auto-play.
return fRetValue;
}
BOOL CMountPoint::_acDriveIsMountedOnDriveLetter(HWND , CAutoPlayParams *papp)
{
return _IsDriveLetter(papp->Drive());
}
BOOL CMountPoint::_acDriveIsRestricted(HWND , CAutoPlayParams *papp)
{
BOOL fIsRestricted = (SHRestricted(REST_NODRIVES) & (1 << DRIVEID(papp->Drive())));
if (!fIsRestricted)
{
fIsRestricted = !(papp->MountPoint()->_IsAutoRunDrive());
}
return fIsRestricted;
}
BOOL CMountPoint::_acHasAutorunCommand(HWND , CAutoPlayParams *papp)
{
BOOL fRet = FALSE;
if ((papp->IsContentTypePresent(CT_AUTORUNINF)) &&
(DT_ANYLOCALDRIVES & papp->DriveType()))
{
CMtPtLocal* pmtptl = (CMtPtLocal*)papp->MountPoint();
if (pmtptl->_CanUseVolume())
{
if (pmtptl->_pvol->dwMediaCap & HWDMC_HASAUTORUNCOMMAND)
{
fRet = TRUE;
}
}
else
{
fRet = papp->MountPoint()->_IsAutorun();
}
}
else
{
fRet = papp->IsContentTypePresent(CT_AUTORUNINF);
}
return fRet;
}
BOOL CMountPoint::_acHasUseAutoPLAY(HWND , CAutoPlayParams *papp)
{
BOOL fRet = FALSE;
if (papp->IsContentTypePresent(CT_AUTORUNINF) &&
(DT_ANYLOCALDRIVES & papp->DriveType()))
{
CMtPtLocal* pmtptl = (CMtPtLocal*)papp->MountPoint();
if (pmtptl->_CanUseVolume())
{
if (pmtptl->_pvol->dwMediaCap & HWDMC_HASUSEAUTOPLAY)
{
fRet = TRUE;
}
}
else
{
// If we're here, most likely the ShellService is not running, so we won't be able to
// Autoplay anyway.
fRet = FALSE;
}
}
else
{
// not supported for remote drives
}
return fRet;
}
BOOL CMountPoint::_acForegroundAppAllowsAutorun(HWND hwndForeground, CAutoPlayParams *papp)
{
return _AppAllowsAutoRun(hwndForeground, papp->MountPoint());
}
static const TWODWORDS allcontentsVSarcontenttypemappings[] =
{
{ CT_AUTORUNINF , ARCONTENT_AUTORUNINF },
{ CT_CDAUDIO , ARCONTENT_AUDIOCD },
{ CT_DVDMOVIE , ARCONTENT_DVDMOVIE },
{ CT_UNKNOWNCONTENT , ARCONTENT_UNKNOWNCONTENT },
{ CT_BLANKCDR , ARCONTENT_BLANKCD },
{ CT_BLANKCDRW , ARCONTENT_BLANKCD },
{ CT_BLANKDVDR , ARCONTENT_BLANKDVD },
{ CT_BLANKDVDRW , ARCONTENT_BLANKDVD },
{ CT_AUTOPLAYMUSIC , ARCONTENT_AUTOPLAYMUSIC },
{ CT_AUTOPLAYPIX , ARCONTENT_AUTOPLAYPIX },
{ CT_AUTOPLAYMOVIE , ARCONTENT_AUTOPLAYVIDEO },
};
BOOL CMountPoint::_acQueryCancelAutoplayAllowsAutorun(HWND , CAutoPlayParams *papp)
{
BOOL fAllow = TRUE;
DWORD dwAutorunContentType = _DoDWORDMapping(papp->ContentType(),
allcontentsVSarcontenttypemappings, ARRAYSIZE(allcontentsVSarcontenttypemappings),
TRUE);
_QueryRunningObject(papp->MountPoint(), dwAutorunContentType, &fAllow);
return fAllow;
}
BOOL CMountPoint::_acUserHasSelectedApplication(HWND hwndForeground, CAutoPlayParams *papp)
{
BOOL fRet = FALSE;
WCHAR szContentTypeHandler[MAX_CONTENTTYPEHANDLER];
DWORD dwMtPtContentType = papp->ContentType() & ~CT_UNKNOWNCONTENT;
HRESULT hr = _GetContentTypeHandler(dwMtPtContentType, szContentTypeHandler, ARRAYSIZE(szContentTypeHandler));
if (SUCCEEDED(hr))
{
IAutoplayHandler* piah;
hr = _GetAutoplayHandler(papp->Drive(), TEXT("ContentArrival"), szContentTypeHandler, &piah);
if (SUCCEEDED(hr))
{
LPWSTR pszHandlerDefault;
hr = piah->GetDefaultHandler(&pszHandlerDefault);
if (SUCCEEDED(hr))
{
if (HANDLERDEFAULT_MORERECENTHANDLERSINSTALLED &
HANDLERDEFAULT_GETFLAGS(hr))
{
fRet = FALSE;
}
else
{
if (HANDLERDEFAULT_USERCHOSENDEFAULT &
HANDLERDEFAULT_GETFLAGS(hr))
{
fRet = lstrcmpi(pszHandlerDefault, TEXT("MSPromptEachTime"));
}
else
{
fRet = FALSE;
}
}
if (!fRet)
{
if (((HANDLERDEFAULT_USERCHOSENDEFAULT &
HANDLERDEFAULT_GETFLAGS(hr)) ||
(HANDLERDEFAULT_EVENTHANDLERDEFAULT &
HANDLERDEFAULT_GETFLAGS(hr))) &&
!(HANDLERDEFAULT_DEFAULTSAREDIFFERENT &
HANDLERDEFAULT_GETFLAGS(hr)))
{
papp->_fCheckAlwaysDoThisCheckBox = TRUE;
}
}
CoTaskMemFree(pszHandlerDefault);
}
piah->Release();
}
}
return fRet;
}
BOOL CMountPoint::_acShellIsForegroundApp(HWND hwndForeground, CAutoPlayParams *papp)
{
BOOL fRet = FALSE;
WCHAR szModule[MAX_PATH];
if (GetWindowModuleFileName(hwndForeground, szModule, ARRAYSIZE(szModule)))
{
if (!lstrcmpi(PathFindFileName(szModule), TEXT("explorer.exe")))
{
fRet = TRUE;
}
}
return fRet;
}
BOOL CMountPoint::_acOSIsServer(HWND , CAutoPlayParams *papp)
{
return IsOS(OS_ANYSERVER);
}
BOOL CMountPoint::_acIsDockedLaptop(HWND hwndForeground, CAutoPlayParams *papp)
{
return (GMID_DOCKED & SHGetMachineInfo(GMI_DOCKSTATE));
}
BOOL CMountPoint::_acDriveIsFormatted(HWND hwndForeground, CAutoPlayParams *papp)
{
return papp->MountPoint()->IsFormatted();
}
BOOL CMountPoint::_acShellExecuteDriveAutorunINF(HWND hwndForeground, CAutoPlayParams *papp)
{
SHELLEXECUTEINFO ei = {
sizeof(ei), // size
SEE_MASK_INVOKEIDLIST | SEE_MASK_FLAG_NO_UI, // flags
NULL,
NULL, // verb
papp->Drive(), // file
papp->Drive(), // params
papp->Drive(), // directory
SW_NORMAL, // show.
NULL, // hinstance
NULL, // IDLIST
NULL, // class name
NULL, // class key
0, // hot key
NULL, // icon
NULL, // hProcess
};
return ShellExecuteEx(&ei);
}
HRESULT _InvokeAutoRunProgid(HKEY hkProgid, LPCWSTR pszVerb, IDataObject *pdo)
{
IShellExtInit *psei;
HRESULT hr = CoCreateInstance(CLSID_ShellFileDefExt, NULL, CLSCTX_INPROC, IID_PPV_ARG(IShellExtInit, &psei));
if (SUCCEEDED(hr))
{
hr = psei->Initialize(NULL, pdo, hkProgid);
if (SUCCEEDED(hr))
{
IContextMenu *pcm;
hr = psei->QueryInterface(IID_PPV_ARG(IContextMenu, &pcm));
if (SUCCEEDED(hr))
{
CHAR szVerb[64];
// maybe hwnd
// maybe punkSite
// maybe ICI flags
SHUnicodeToAnsi(pszVerb, szVerb, ARRAYSIZE(szVerb));
hr = SHInvokeCommandOnContextMenu(NULL, NULL, pcm, 0, szVerb);
pcm->Release();
}
}
psei->Release();
}
return hr;
}
HRESULT _GetProgidAndVerb(DWORD dwContentType, PCWSTR pszHandler, PWSTR pszInvokeProgID,
DWORD cchInvokeProgID, PWSTR pszInvokeVerb, DWORD cchInvokeVerb)
{
HRESULT hr;
if (0 == StrCmpI(pszHandler, TEXT("AutoplayLegacyHandler")) && (dwContentType & (CT_CDAUDIO | CT_DVDMOVIE)))
{
HKEY hkey;
BOOL fGotDefault = FALSE;
if (dwContentType & CT_CDAUDIO)
{
hr = StringCchCopy(pszInvokeProgID, cchInvokeProgID, TEXT("AudioCD"));
}
else
{
ASSERT(dwContentType & CT_DVDMOVIE);
hr = StringCchCopy(pszInvokeProgID, cchInvokeProgID, TEXT("DVD"));
}
if (SUCCEEDED(hr))
{
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CLASSES_ROOT, pszInvokeProgID, 0, MAXIMUM_ALLOWED,
&hkey))
{
HKEY hkey2;
if (ERROR_SUCCESS == RegOpenKeyEx(hkey, TEXT("shell"), 0, MAXIMUM_ALLOWED,
&hkey2))
{
DWORD cbInvokeVerb = cchInvokeVerb * sizeof(WCHAR);
if (ERROR_SUCCESS == RegQueryValueEx(hkey2, NULL, NULL, NULL, (PBYTE)pszInvokeVerb,
&cbInvokeVerb))
{
if (cbInvokeVerb && *pszInvokeVerb)
{
if (cbInvokeVerb != (cchInvokeVerb * sizeof(WCHAR)))
{
fGotDefault = TRUE;
}
}
}
RegCloseKey(hkey2);
}
RegCloseKey(hkey);
}
if (!fGotDefault)
{
hr = StringCchCopy(pszInvokeVerb, cchInvokeVerb, TEXT("play"));
}
}
}
else
{
hr = _GetHandlerInvokeProgIDAndVerb(pszHandler, pszInvokeProgID,
cchInvokeProgID, pszInvokeVerb, cchInvokeVerb);
}
return hr;
}
BOOL CMountPoint::_ExecuteHelper(LPCWSTR pszHandler, LPCWSTR pszContentTypeHandler,
CAutoPlayParams *papp, DWORD dwMtPtContentType)
{
HRESULT hr;
if (lstrcmpi(pszHandler, TEXT("MSTakeNoAction")))
{
WCHAR szInvokeProgID[260];
WCHAR szInvokeVerb[CCH_KEYMAX];
hr = _GetProgidAndVerb(dwMtPtContentType, pszHandler, szInvokeProgID,
ARRAYSIZE(szInvokeProgID), szInvokeVerb, ARRAYSIZE(szInvokeVerb));
if (SUCCEEDED(hr))
{
HKEY hkey;
if (dwMtPtContentType & (CT_CDAUDIO | CT_DVDMOVIE))
{
hr = papp->MountPoint()->_CopyInvokeVerbKey(szInvokeProgID, szInvokeVerb);
if (SUCCEEDED(hr))
{
hkey = papp->MountPoint()->RSDuplicateRootKey();
if (hkey)
{
papp->MountPoint()->RSSetTextValue(TEXT("shell"), NULL, szInvokeVerb,
REG_OPTION_NON_VOLATILE);
}
else
{
hr = E_FAIL;
}
}
}
else
{
hr = ResultFromWin32(RegOpenKeyExW(HKEY_CLASSES_ROOT, szInvokeProgID, 0, MAXIMUM_ALLOWED, &hkey));
}
if (SUCCEEDED(hr))
{
IDataObject* pdo;
hr = papp->DataObject(&pdo);
if (SUCCEEDED(hr))
{
hr = _InvokeAutoRunProgid(hkey, szInvokeVerb, pdo);
pdo->Release();
}
RegCloseKey(hkey);
}
}
}
else
{
hr = S_FALSE;
}
return SUCCEEDED(hr);
}
BOOL CMountPoint::_acExecuteAutoplayDefault(HWND hwndForeground, CAutoPlayParams *papp)
{
BOOL fRet = FALSE;
if (DT_ANYLOCALDRIVES & papp->DriveType())
{
WCHAR szContentTypeHandler[MAX_CONTENTTYPEHANDLER];
DWORD dwMtPtContentType = papp->ContentType() & ~CT_UNKNOWNCONTENT;
HRESULT hr = _GetContentTypeHandler(dwMtPtContentType, szContentTypeHandler, ARRAYSIZE(szContentTypeHandler));
if (SUCCEEDED(hr))
{
IAutoplayHandler* piah;
hr = _GetAutoplayHandler(papp->Drive(), TEXT("ContentArrival"), szContentTypeHandler, &piah);
if (SUCCEEDED(hr))
{
LPWSTR pszHandlerDefault;
hr = piah->GetDefaultHandler(&pszHandlerDefault);
if (SUCCEEDED(hr))
{
// No need to check for (S_HANDLERS_MORE_RECENT_THAN_USER_SELECTION == hr) here
// It should have been caught by _acUserHasSelectedApplication
fRet = _ExecuteHelper(pszHandlerDefault, szContentTypeHandler, papp, dwMtPtContentType);
}
CoTaskMemFree(pszHandlerDefault);
}
piah->Release();
}
}
return fRet;
}
BOOL CMountPoint::_acWasjustDocked(HWND hwndForeground, CAutoPlayParams *papp)
{
BOOL fRet = FALSE;
if (DT_ANYLOCALDRIVES & papp->DriveType())
{
CMtPtLocal* pmtptl = (CMtPtLocal*)papp->MountPoint();
if (pmtptl->_CanUseVolume())
{
if (pmtptl->_pvol->dwVolumeFlags & HWDVF_STATE_JUSTDOCKED)
{
fRet = TRUE;
}
}
}
return fRet;
}
CRITICAL_SECTION g_csAutoplayPrompt = {0};
HDPA g_hdpaAutoplayPrompt = NULL;
BOOL CMountPoint::_acPromptUser(HWND hwndForeground, CAutoPlayParams *papp)
{
BOOL fRet = FALSE;
BOOL fShowDlg = TRUE;
if (papp->Drive())
{
fShowDlg = _AddAutoplayPrompt(papp->Drive());
}
if (fShowDlg)
{
CBaseContentDlg* pdlg;
papp->ForceSniff();
DWORD dwMtPtContentType = papp->ContentType() & ~CT_UNKNOWNCONTENT;
if (dwMtPtContentType)
{
if (_acIsMixedContent(hwndForeground, papp))
{
pdlg = new CMixedContentDlg();
dwMtPtContentType &= CT_ANYAUTOPLAYCONTENT;
if (pdlg)
{
pdlg->_iResource = DLG_APMIXEDCONTENT;
}
}
else
{
pdlg = new CHWContentPromptDlg();
if (pdlg)
{
pdlg->_iResource = DLG_APPROMPTUSER;
}
}
}
if (pdlg)
{
// Better be a local drive
if (DT_ANYLOCALDRIVES & papp->DriveType())
{
CMtPtLocal* pmtptl = (CMtPtLocal*)papp->MountPoint();
if (pmtptl->_CanUseVolume())
{
HRESULT hr = pdlg->Init(pmtptl->_pvol->pszDeviceIDVolume, papp->Drive(), dwMtPtContentType,
papp->_fCheckAlwaysDoThisCheckBox);
pdlg->_hinst = g_hinst;
pdlg->_hwndParent = NULL;
if (SUCCEEDED(hr))
{
INT_PTR iRet = pdlg->DoModal(pdlg->_hinst, MAKEINTRESOURCE(pdlg->_iResource),
pdlg->_hwndParent);
if (IDOK == iRet)
{
fRet = _ExecuteHelper(pdlg->_szHandler, pdlg->_szContentTypeHandler,
papp, dwMtPtContentType);
}
}
}
}
pdlg->Release();
}
if (papp->Drive())
{
_RemoveFromAutoplayPromptHDPA(papp->Drive());
}
}
return fRet;
}
BOOL CMountPoint::_acIsMixedContent(HWND hwndForeground, CAutoPlayParams *papp)
{
BOOL fRet;
if (papp->IsContentTypePresent(CT_ANYAUTOPLAYCONTENT))
{
fRet = IsMixedContent(papp->ContentType());
}
else
{
fRet = FALSE;
}
return fRet;
}
BOOL CMountPoint::_acAlwaysReturnsTRUE(HWND hwndForeground, CAutoPlayParams *papp)
{
return TRUE;
}
BOOL CMountPoint::_acShouldSniff(HWND hwndForeground, CAutoPlayParams *papp)
{
BOOL fRet = TRUE;
CMtPtLocal* pmtptl = papp->MountPointLocal();
if (pmtptl)
{
if (pmtptl->_CanUseVolume())
{
fRet = !(HWDVF_STATE_DONOTSNIFFCONTENT & pmtptl->_pvol->dwVolumeFlags);
}
}
return fRet;
}
BOOL CMountPoint::_acAddAutoplayVerb(HWND hwndForeground, CAutoPlayParams *papp)
{
CMtPtLocal* pmtptl = papp->MountPointLocal();
if (pmtptl)
{
if (pmtptl->_CanUseVolume())
{
// We don't care about the return value
pmtptl->_AddAutoplayVerb();
}
}
return TRUE;
}
//
// END: Fcts for matrix below
#define SKIPDEPENDENTS_ONFALSE 0x00000001 // Skips dependents
#define SKIPDEPENDENTS_ONTRUE 0x00000002 // Skips dependents
#define CANCEL_AUTOPLAY_ONFALSE 0x00000004
#define CANCEL_AUTOPLAY_ONTRUE 0x00000008
#define NOTAPPLICABLE_ONANY 0x00000010
#define LEVEL_EXECUTE 0x10000000
#define LEVEL_SKIP 0x20000000
#define LEVEL_SPECIALMASK 0x30000000
#define LEVEL_REALLEVELMASK 0x0FFFFFFF
typedef BOOL (AUTORUNFCT)(HWND hwndForeground, CAutoPlayParams *papp);
// fct is called with pszDrive, papp->MountPoint(), hwndForeground, drive type and content type
struct AUTORUNCONDITION
{
DWORD dwNestingLevel;
DWORD dwMtPtDriveType;
DWORD dwMtPtContentType;
DWORD dwReturnValueHandling;
AUTORUNFCT* fct;
#ifdef DEBUG
LPCWSTR pszDebug;
#endif
};
// For this table to be more readable, add the content of \\stephstm\public\usertype.dat to
// %ProgramFiles%\Microsoft Visual Studio\Common\MSDev98\Bin\usertype.dat
// then restart MSDev
// AR_ENTRY -> AUTORUN_ENTRY
#ifdef DEBUG
#define AR_ENTRY(a, b, c, d, e) { (a), (b), (c), (d), CMountPoint::e, TEXT(#a) TEXT(":") TEXT(#b) TEXT(":") TEXT(#c) TEXT(":") TEXT(#d) TEXT(":") TEXT(#e) }
#else
#define AR_ENTRY(a, b, c, d, e) { (a), (b), (c), (d), CMountPoint::e }
#endif
// DT_* -> DriveType
// CT_* -> ContentType
static const AUTORUNCONDITION _rgAutorun[] =
{
// We don't autorun if the drive is not mounted on a drive letter
AR_ENTRY(0, DT_ANYTYPE, CT_ANYCONTENT, CANCEL_AUTOPLAY_ONFALSE, _acDriveIsMountedOnDriveLetter),
// We don't autorun if this is a restricted drive
AR_ENTRY(0, DT_ANYTYPE & ~DT_REMOTE, CT_ANYCONTENT, CANCEL_AUTOPLAY_ONTRUE, _acDriveIsRestricted),
// Add the Autoplay Verb
AR_ENTRY(1, DT_ANYTYPE & ~DT_REMOTE, CT_ANYCONTENT & ~CT_AUTORUNINF, SKIPDEPENDENTS_ONFALSE, _acAddAutoplayVerb),
// We don't autorun if the Shift key is down
AR_ENTRY(0, DT_ANYTYPE, CT_ANYCONTENT, CANCEL_AUTOPLAY_ONTRUE, _acShiftKeyDown),
// We don't autorun if a laptop was just docked. All devices in the craddle come as nhew devices.
AR_ENTRY(0, DT_ANYTYPE & ~DT_REMOTE, CT_ANYCONTENT, CANCEL_AUTOPLAY_ONTRUE, _acWasjustDocked),
// We don't autorun if the Current Desktop is not the active console desktop
AR_ENTRY(0, DT_ANYTYPE, CT_ANYCONTENT, CANCEL_AUTOPLAY_ONFALSE, _acCurrentDesktopIsActiveConsole),
// We don't autorun if the Current Desktop is not the active console desktop
AR_ENTRY(0, DT_ANYTYPE, CT_ANYCONTENT, CANCEL_AUTOPLAY_ONTRUE, _acDirectXAppRunningFullScreen),
// Remote drive always Autorun (mostly opening folder)
AR_ENTRY(1, DT_REMOTE, CT_ANYCONTENT, SKIPDEPENDENTS_ONFALSE, _acForegroundAppAllowsAutorun),
AR_ENTRY(1, DT_REMOTE, CT_ANYCONTENT, SKIPDEPENDENTS_ONFALSE, _acQueryCancelAutoplayAllowsAutorun),
AR_ENTRY(2 | LEVEL_EXECUTE, DT_REMOTE, CT_ANYCONTENT, NOTAPPLICABLE_ONANY, _acShellExecuteDriveAutorunINF),
// Autorun.inf
AR_ENTRY(1, DT_ANYTYPE & ~DT_REMOVABLEDISK, CT_AUTORUNINF, SKIPDEPENDENTS_ONFALSE, _acHasAutorunCommand),
AR_ENTRY(2, DT_ANYTYPE & ~DT_REMOVABLEDISK, CT_AUTORUNINF, SKIPDEPENDENTS_ONTRUE, _acHasUseAutoPLAY),
AR_ENTRY(3, DT_ANYTYPE & ~DT_REMOVABLEDISK, CT_AUTORUNINF, CANCEL_AUTOPLAY_ONFALSE, _acForegroundAppAllowsAutorun),
AR_ENTRY(3, DT_ANYTYPE & ~DT_REMOVABLEDISK, CT_AUTORUNINF, CANCEL_AUTOPLAY_ONFALSE, _acQueryCancelAutoplayAllowsAutorun),
AR_ENTRY(4 | LEVEL_EXECUTE, DT_ANYCDDRIVES, CT_AUTORUNINF, NOTAPPLICABLE_ONANY, _acShellExecuteDriveAutorunINF),
// CD Audio
AR_ENTRY(1, DT_ANYCDDRIVES, CT_CDAUDIO, CANCEL_AUTOPLAY_ONFALSE, _acForegroundAppAllowsAutorun),
AR_ENTRY(1, DT_ANYCDDRIVES, CT_CDAUDIO, CANCEL_AUTOPLAY_ONFALSE, _acQueryCancelAutoplayAllowsAutorun),
AR_ENTRY(2, DT_ANYCDDRIVES, CT_CDAUDIO, SKIPDEPENDENTS_ONFALSE, _acUserHasSelectedApplication),
AR_ENTRY(3 | LEVEL_EXECUTE, DT_ANYCDDRIVES, CT_CDAUDIO, NOTAPPLICABLE_ONANY, _acExecuteAutoplayDefault),
AR_ENTRY(LEVEL_EXECUTE | 1, DT_ANYCDDRIVES, CT_CDAUDIO, NOTAPPLICABLE_ONANY, _acPromptUser),
// DVD Movie
AR_ENTRY(1, DT_ANYCDDRIVES, CT_DVDMOVIE, CANCEL_AUTOPLAY_ONFALSE, _acForegroundAppAllowsAutorun),
AR_ENTRY(1, DT_ANYCDDRIVES, CT_DVDMOVIE, CANCEL_AUTOPLAY_ONFALSE, _acQueryCancelAutoplayAllowsAutorun),
AR_ENTRY(2, DT_ANYCDDRIVES, CT_DVDMOVIE, SKIPDEPENDENTS_ONFALSE, _acUserHasSelectedApplication),
AR_ENTRY(3 | LEVEL_EXECUTE, DT_ANYCDDRIVES, CT_DVDMOVIE, NOTAPPLICABLE_ONANY, _acExecuteAutoplayDefault),
AR_ENTRY(LEVEL_EXECUTE | 1, DT_ANYCDDRIVES, CT_DVDMOVIE, NOTAPPLICABLE_ONANY, _acPromptUser),
// Writable CDs
AR_ENTRY(1, DT_ANYCDDRIVES, CT_BLANKCDWRITABLE, CANCEL_AUTOPLAY_ONFALSE, _acForegroundAppAllowsAutorun),
AR_ENTRY(1, DT_ANYCDDRIVES, CT_BLANKCDWRITABLE, CANCEL_AUTOPLAY_ONFALSE, _acQueryCancelAutoplayAllowsAutorun),
AR_ENTRY(2, DT_ANYCDDRIVES, CT_BLANKCDWRITABLE, SKIPDEPENDENTS_ONFALSE, _acUserHasSelectedApplication),
AR_ENTRY(3 | LEVEL_EXECUTE, DT_ANYCDDRIVES, CT_BLANKCDWRITABLE, NOTAPPLICABLE_ONANY, _acExecuteAutoplayDefault),
AR_ENTRY(LEVEL_EXECUTE | 1, DT_ANYCDDRIVES, CT_BLANKCDWRITABLE, NOTAPPLICABLE_ONANY, _acPromptUser),
// Writable DVDs
AR_ENTRY(LEVEL_SKIP | 1, DT_ANYCDDRIVES, CT_BLANKCDWRITABLE, CANCEL_AUTOPLAY_ONFALSE, _acForegroundAppAllowsAutorun),
AR_ENTRY(LEVEL_SKIP | 1, DT_ANYCDDRIVES, CT_BLANKCDWRITABLE, CANCEL_AUTOPLAY_ONFALSE, _acQueryCancelAutoplayAllowsAutorun),
AR_ENTRY(LEVEL_SKIP | 2, DT_ANYCDDRIVES, CT_BLANKCDWRITABLE, SKIPDEPENDENTS_ONFALSE, _acUserHasSelectedApplication),
AR_ENTRY(LEVEL_SKIP | 3 | LEVEL_EXECUTE, DT_ANYDVDDRIVES, CT_BLANKDVDWRITABLE, NOTAPPLICABLE_ONANY, _acExecuteAutoplayDefault),
AR_ENTRY(LEVEL_SKIP | LEVEL_EXECUTE | 1, DT_ANYDVDDRIVES, CT_BLANKDVDWRITABLE, NOTAPPLICABLE_ONANY, _acPromptUser),
// Mixed content
AR_ENTRY(1, DT_ANYTYPE & ~DT_REMOTE, CT_ANYAUTOPLAYCONTENT, SKIPDEPENDENTS_ONFALSE, _acIsMixedContent),
AR_ENTRY(2, DT_ANYTYPE & ~DT_REMOTE, CT_ANYAUTOPLAYCONTENT, SKIPDEPENDENTS_ONTRUE, _acUserHasSelectedApplication),
AR_ENTRY(3, DT_ANYTYPE & ~DT_REMOTE, CT_ANYAUTOPLAYCONTENT, CANCEL_AUTOPLAY_ONFALSE, _acQueryCancelAutoplayAllowsAutorun),
AR_ENTRY(4 | LEVEL_EXECUTE, DT_ANYTYPE & ~DT_REMOTE, CT_ANYAUTOPLAYCONTENT, NOTAPPLICABLE_ONANY, _acPromptUser),
AR_ENTRY(LEVEL_EXECUTE | 2, DT_ANYTYPE & ~DT_REMOTE, CT_ANYAUTOPLAYCONTENT, NOTAPPLICABLE_ONANY, _acExecuteAutoplayDefault),
// Single Autoplay content
AR_ENTRY(1, DT_ANYTYPE & ~DT_REMOTE, CT_ANYAUTOPLAYCONTENT, CANCEL_AUTOPLAY_ONFALSE, _acQueryCancelAutoplayAllowsAutorun),
AR_ENTRY(2, DT_ANYTYPE & ~DT_REMOTE, CT_ANYAUTOPLAYCONTENT, SKIPDEPENDENTS_ONTRUE, _acUserHasSelectedApplication),
AR_ENTRY(3 | LEVEL_EXECUTE, DT_ANYTYPE & ~DT_REMOTE, CT_ANYAUTOPLAYCONTENT, NOTAPPLICABLE_ONANY, _acPromptUser),
AR_ENTRY(LEVEL_EXECUTE | 2, DT_ANYTYPE & ~DT_REMOTE, CT_ANYAUTOPLAYCONTENT, NOTAPPLICABLE_ONANY, _acExecuteAutoplayDefault),
// Unknown content
AR_ENTRY(1, DT_ANYREMOVABLEMEDIADRIVES, CT_UNKNOWNCONTENT, CANCEL_AUTOPLAY_ONFALSE, _acForegroundAppAllowsAutorun),
AR_ENTRY(1, DT_ANYREMOVABLEMEDIADRIVES, CT_UNKNOWNCONTENT, CANCEL_AUTOPLAY_ONFALSE, _acQueryCancelAutoplayAllowsAutorun),
// If we should not sniff, we should not open a folder either
AR_ENTRY(2, DT_ANYREMOVABLEMEDIADRIVES, CT_UNKNOWNCONTENT, SKIPDEPENDENTS_ONFALSE, _acShouldSniff),
AR_ENTRY(3 | LEVEL_EXECUTE, DT_ANYREMOVABLEMEDIADRIVES, CT_UNKNOWNCONTENT, NOTAPPLICABLE_ONANY, _acShellExecuteDriveAutorunINF),
// Weird CDs have autorun.inf but no autorun command
AR_ENTRY(2, DT_ANYREMOVABLEMEDIADRIVES, CT_AUTORUNINF, SKIPDEPENDENTS_ONTRUE, _acHasAutorunCommand),
AR_ENTRY(3 | LEVEL_EXECUTE, DT_ANYREMOVABLEMEDIADRIVES, CT_AUTORUNINF, NOTAPPLICABLE_ONANY, _acShellExecuteDriveAutorunINF),
// Former ShellOpen, basically we ShellExecute whatever drives except CD drives if the shell is in the foreground
AR_ENTRY(1, ~DT_ANYCDDRIVES, CT_ANYCONTENT & ~CT_ANYAUTOPLAYCONTENT, SKIPDEPENDENTS_ONFALSE, _acShellIsForegroundApp),
AR_ENTRY(2, ~DT_ANYCDDRIVES, CT_ANYCONTENT & ~CT_ANYAUTOPLAYCONTENT, CANCEL_AUTOPLAY_ONTRUE, _acAlwaysReturnsTRUE),
// Additonnal restrictions on Fixed disk drive
AR_ENTRY(3, DT_FIXEDDISK, CT_ANYCONTENT & ~CT_ANYAUTOPLAYCONTENT, CANCEL_AUTOPLAY_ONFALSE, _acDriveIsFormatted),
AR_ENTRY(4, DT_FIXEDDISK, CT_ANYCONTENT & ~CT_ANYAUTOPLAYCONTENT, CANCEL_AUTOPLAY_ONTRUE, _acOSIsServer),
AR_ENTRY(5, DT_FIXEDDISK, CT_ANYCONTENT & ~CT_ANYAUTOPLAYCONTENT, CANCEL_AUTOPLAY_ONTRUE, _acIsDockedLaptop),
AR_ENTRY(6, DT_FIXEDDISK, CT_ANYCONTENT & ~CT_ANYAUTOPLAYCONTENT, CANCEL_AUTOPLAY_ONFALSE, _acForegroundAppAllowsAutorun),
AR_ENTRY(6, DT_FIXEDDISK, CT_ANYCONTENT & ~CT_ANYAUTOPLAYCONTENT, CANCEL_AUTOPLAY_ONFALSE, _acQueryCancelAutoplayAllowsAutorun),
AR_ENTRY(7 | LEVEL_EXECUTE, DT_ANYTYPE, CT_ANYCONTENT & ~CT_ANYAUTOPLAYCONTENT, NOTAPPLICABLE_ONANY, _acShellExecuteDriveAutorunINF),
// Non Fixed Disk drives
AR_ENTRY(3, ~DT_FIXEDDISK, CT_ANYCONTENT & ~CT_ANYAUTOPLAYCONTENT, CANCEL_AUTOPLAY_ONFALSE, _acForegroundAppAllowsAutorun),
AR_ENTRY(3, ~DT_FIXEDDISK, CT_ANYCONTENT & ~CT_ANYAUTOPLAYCONTENT, CANCEL_AUTOPLAY_ONFALSE, _acQueryCancelAutoplayAllowsAutorun),
AR_ENTRY(4 | LEVEL_EXECUTE, ~DT_FIXEDDISK, CT_ANYCONTENT & ~CT_ANYAUTOPLAYCONTENT, NOTAPPLICABLE_ONANY, _acShellExecuteDriveAutorunINF),
};
// This array will be dumped in the registry under the Volume GUID of the
// drive in a value named _AutorunStatus
//
// Each byte represents an entry in the above table. Following is the
// meaning of each byte:
//
// 01: Condition was TRUE
// 00: Condition was FALSE
// CF: ContentType condition was failed
// DF: DriveType condition was failed
// 5F: Condition was skipped (5 looks like an 'S' :)
// EE: Condition was executed
// FF: Never got there
// Use a struct to avoid alignement issues
#pragma pack(push, 4)
struct AUTORUNSTATUS
{
BYTE _rgbAutorunStatus[ARRAYSIZE(_rgAutorun)];
DWORD dwDriveType;
DWORD dwContentType;
};
#pragma pack(pop)
static AUTORUNSTATUS s_autorunstatus;
// static
void CMountPoint::DoAutorun(LPCWSTR pszDrive, DWORD dwAutorunFlags)
{
CMountPoint* pmtpt = GetMountPoint(pszDrive);
FillMemory(s_autorunstatus._rgbAutorunStatus, sizeof(s_autorunstatus._rgbAutorunStatus), -1);
if (pmtpt)
{
CAutoPlayParams app(pszDrive, pmtpt, dwAutorunFlags);
if (AUTORUNFLAG_MENUINVOKED & dwAutorunFlags)
{
_acPromptUser(GetForegroundWindow(), &app);
}
else
{
_DoAutorunHelper(&app);
}
pmtpt->Release();
}
}
void CAutoPlayParams::_TrySniff()
{
if (!(APS_DID_SNIFF & _state))
{
if (_ShouldSniffDrive(TRUE))
{
DWORD dwFound;
if (SUCCEEDED(_Sniff(&dwFound)))
{
_dwContentType |= dwFound;
}
}
_state |= APS_DID_SNIFF;
}
}
BOOL CAutoPlayParams::IsContentTypePresent(DWORD dwContentType)
{
BOOL fRet;
if (CT_ANYCONTENT == dwContentType)
{
fRet = TRUE;
}
else
{
// We special case this because we do not want to sniff at this point
if ((CT_ANYCONTENT & ~CT_AUTORUNINF) == dwContentType)
{
if (CT_AUTORUNINF == _dwContentType)
{
fRet = FALSE;
}
else
{
// Anything else is good
fRet = TRUE;
}
}
else
{
if (CT_ANYAUTOPLAYCONTENT & dwContentType)
{
_TrySniff();
}
fRet = !!(dwContentType & _dwContentType);
}
}
return fRet;
}
void CAutoPlayParams::ForceSniff()
{
if (AUTORUNFLAG_MENUINVOKED & _dwAutorunFlags)
{
_TrySniff();
}
}
// static
void CMountPoint::_DoAutorunHelper(CAutoPlayParams *papp)
{
DWORD dwMaxLevelToProcess = 0;
BOOL fStop = FALSE;
HWND hwndForeground = GetForegroundWindow();
for (DWORD dwStep = 0; !fStop && (dwStep < ARRAYSIZE(_rgAutorun)); ++dwStep)
{
if (!(_rgAutorun[dwStep].dwNestingLevel & LEVEL_SKIP))
{
if ((_rgAutorun[dwStep].dwNestingLevel & LEVEL_REALLEVELMASK) <= dwMaxLevelToProcess)
{
BOOL fConditionResult = FALSE;
// We do not want to Cancel the whole Autoplay operation if we do not get a
// match for a drive type or content type. We do the Cancel Autoplay only
// if the condition was evaluated.
BOOL fConditionEvaluated = FALSE;
if (_rgAutorun[dwStep].dwMtPtDriveType & papp->DriveType())
{
if (papp->IsContentTypePresent(_rgAutorun[dwStep].dwMtPtContentType))
{
if (!(_rgAutorun[dwStep].dwNestingLevel & LEVEL_EXECUTE))
{
fConditionResult = ((_rgAutorun[dwStep].fct)(hwndForeground, papp));
s_autorunstatus._rgbAutorunStatus[dwStep] = fConditionResult ? 1 : 0;
fConditionEvaluated = TRUE;
}
else
{
// LEVEL_EXECUTE
#ifdef DEBUG
TraceMsg(TF_MOUNTPOINT, "AUTORUN[%d]: EXECUTING -> %s", dwStep, _rgAutorun[dwStep].pszDebug);
#endif
_rgAutorun[dwStep].fct(hwndForeground, papp);
// 2 execute
s_autorunstatus._rgbAutorunStatus[dwStep] = 0xEE;
// We're done
fStop = TRUE;
}
}
else
{
#ifdef DEBUG
TraceMsg(TF_MOUNTPOINT, "AUTORUN[%d]: NO MATCH on CONTENTTYPE, %s ", dwStep, _rgAutorun[dwStep].pszDebug);
#endif
s_autorunstatus._rgbAutorunStatus[dwStep] = 0xCF;
}
}
else
{
#ifdef DEBUG
TraceMsg(TF_MOUNTPOINT, "AUTORUN[%d]: NO MATCH on DRIVETYPE, %s ", dwStep, _rgAutorun[dwStep].pszDebug);
#endif
s_autorunstatus._rgbAutorunStatus[dwStep] = 0xDF;
}
if (!fStop)
{
if (fConditionResult)
{
#ifdef DEBUG
TraceMsg(TF_MOUNTPOINT, "AUTORUN[%d]: TRUE -> %s", dwStep, _rgAutorun[dwStep].pszDebug);
#endif
switch (_rgAutorun[dwStep].dwReturnValueHandling)
{
case SKIPDEPENDENTS_ONTRUE:
dwMaxLevelToProcess = _rgAutorun[dwStep].dwNestingLevel & LEVEL_REALLEVELMASK;
break;
case CANCEL_AUTOPLAY_ONTRUE:
if (fConditionEvaluated)
{
fStop = TRUE;
}
break;
default:
dwMaxLevelToProcess = (_rgAutorun[dwStep].dwNestingLevel & LEVEL_REALLEVELMASK) + 1;
break;
case NOTAPPLICABLE_ONANY:
break;
}
}
else
{
#ifdef DEBUG
TraceMsg(TF_MOUNTPOINT, "AUTORUN[%d]: FALSE -> %s", dwStep, _rgAutorun[dwStep].pszDebug);
#endif
switch (_rgAutorun[dwStep].dwReturnValueHandling)
{
case SKIPDEPENDENTS_ONFALSE:
dwMaxLevelToProcess = _rgAutorun[dwStep].dwNestingLevel & LEVEL_REALLEVELMASK;
break;
case CANCEL_AUTOPLAY_ONFALSE:
if (fConditionEvaluated)
{
fStop = TRUE;
}
break;
default:
dwMaxLevelToProcess = (_rgAutorun[dwStep].dwNestingLevel & LEVEL_REALLEVELMASK) + 1;
break;
case NOTAPPLICABLE_ONANY:
break;
}
}
}
}
else
{
#ifdef DEBUG
TraceMsg(TF_MOUNTPOINT, "AUTORUN[%d]: SKIPPING , %s ", dwStep, _rgAutorun[dwStep].pszDebug);
#endif
s_autorunstatus._rgbAutorunStatus[dwStep] = 0x5F;
}
}
else
{
#ifdef DEBUG
TraceMsg(TF_MOUNTPOINT, "AUTORUN[%d]: LVL-SKIP , %s ", dwStep, _rgAutorun[dwStep].pszDebug);
#endif
s_autorunstatus._rgbAutorunStatus[dwStep] = 0x5F;
}
}
s_autorunstatus.dwDriveType = papp->DriveType();
s_autorunstatus.dwContentType = papp->ContentType();
papp->MountPoint()->SetAutorunStatus((BYTE*)&s_autorunstatus, sizeof(s_autorunstatus));
}
DWORD _DoDWORDMapping(DWORD dwLeft, const TWODWORDS* rgtwodword, DWORD ctwodword, BOOL fORed)
{
DWORD dwRight = 0;
for (DWORD dw = 0; dw < ctwodword; ++dw)
{
if (fORed)
{
if (dwLeft & rgtwodword[dw].dwLeft)
{
dwRight |= rgtwodword[dw].dwRight;
}
}
else
{
if (dwLeft == rgtwodword[dw].dwLeft)
{
dwRight = rgtwodword[dw].dwRight;
break;
}
}
}
return dwRight;
}
STDMETHODIMP CSniffDrive::QueryInterface(REFIID riid, void **ppv)
{
static const QITAB qit[] =
{
QITABENT(CSniffDrive, INamespaceWalkCB),
{ 0 },
};
return QISearch(this, qit, riid, ppv);
}
STDMETHODIMP CSniffDrive::FoundItem(IShellFolder *psf, LPCITEMIDLIST pidl)
{
// include everything
HRESULT hr = S_OK;
if (!_pne || !_pne->fStopSniffing)
{
// if we found everything we dont need to worry about sniffing
// now we are just populating the dataobject
if (!_FoundEverything())
{
PERCEIVED gen = GetPerceivedType(psf, pidl);
if (GEN_IMAGE == gen)
{
_dwFound |= CT_AUTOPLAYPIX;
}
else if (GEN_AUDIO == gen)
{
_dwFound |= CT_AUTOPLAYMUSIC;
}
else if (GEN_VIDEO == gen)
{
_dwFound |= CT_AUTOPLAYMOVIE;
}
else
{
_dwFound |= CT_UNKNOWNCONTENT;
}
hr = S_OK;
}
}
else
{
hr = E_FAIL;
}
// we never want the results on the sniff
return hr;
}
STDMETHODIMP CSniffDrive::EnterFolder(IShellFolder *psf, LPCITEMIDLIST pidl)
{
return S_OK;
}
STDMETHODIMP CSniffDrive::LeaveFolder(IShellFolder *psf, LPCITEMIDLIST pidl)
{
return S_OK;
}
STDMETHODIMP CSniffDrive::InitializeProgressDialog(LPWSTR *ppszTitle, LPWSTR *ppszCancel)
{
*ppszCancel = NULL; // use default
TCHAR szMsg[256];
LoadString(g_hinst, IDS_AP_SNIFFPROGRESSDIALOG, szMsg, ARRAYSIZE(szMsg));
return SHStrDup(szMsg, ppszTitle);
}
// static
HRESULT CSniffDrive::Init(HANDLE hThreadSCN)
{
HRESULT hr;
if (DuplicateHandle(GetCurrentProcess(), hThreadSCN, GetCurrentProcess(),
&_hThreadSCN, THREAD_ALL_ACCESS, FALSE, 0))
{
hr = S_OK;
}
else
{
hr = E_FAIL;
}
return S_OK;
}
// static
HRESULT CSniffDrive::CleanUp()
{
if (_dpaNotifs)
{
// We should not need to delete the items, they should all be removed. Even
// if they're, we should leave them there since something will probably try
// to access them.
_dpaNotifs.Destroy();
_dpaNotifs = NULL;
}
if (_hThreadSCN)
{
CloseHandle(_hThreadSCN);
_hThreadSCN = NULL;
}
return S_OK;
}
// static
HRESULT CSniffDrive::InitNotifyWindow(HWND hwnd)
{
_hwndNotify = hwnd;
return S_OK;
}
HRESULT CSniffDrive::RegisterForNotifs(LPCWSTR pszDeviceIDVolume)
{
HRESULT hr;
_pne = new PNPNOTIFENTRY();
if (_pne)
{
HANDLE hDevice = CreateFile(pszDeviceIDVolume, FILE_READ_ATTRIBUTES,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (INVALID_HANDLE_VALUE != hDevice)
{
DEV_BROADCAST_HANDLE dbhNotifFilter = {0};
// Assume failure
hr = E_FAIL;
dbhNotifFilter.dbch_size = sizeof(DEV_BROADCAST_HANDLE);
dbhNotifFilter.dbch_devicetype = DBT_DEVTYP_HANDLE;
dbhNotifFilter.dbch_handle = hDevice;
_pne->hdevnotify = RegisterDeviceNotification(_hwndNotify, &dbhNotifFilter,
DEVICE_NOTIFY_WINDOW_HANDLE);
if (_pne->hdevnotify)
{
_pne->AddRef();
if (QueueUserAPC(CSniffDrive::_RegisterForNotifsHelper, _hThreadSCN, (ULONG_PTR)_pne))
{
hr = S_OK;
}
else
{
_pne->Release();
}
}
CloseHandle(hDevice);
}
else
{
hr = E_FAIL;
}
if (FAILED(hr))
{
// Something must have gone wrong
_pne->Release();
_pne = NULL;
}
}
else
{
hr = E_OUTOFMEMORY;
}
return hr;
}
HRESULT CSniffDrive::UnregisterForNotifs()
{
UnregisterDeviceNotification(_pne->hdevnotify);
QueueUserAPC(CSniffDrive::_UnregisterForNotifsHelper, _hThreadSCN, (ULONG_PTR)_pne);
_pne->Release();
_pne = NULL;
return S_OK;
}
// static
void CALLBACK CSniffDrive::_RegisterForNotifsHelper(ULONG_PTR ul)
{
PNPNOTIFENTRY* pne = (PNPNOTIFENTRY*)ul;
if (!_dpaNotifs)
{
_dpaNotifs.Create(1);
}
if (_dpaNotifs)
{
// We do not check the return value. We cannot free it, since the thread that
// queued this APC to us, expect this chunk of mem to be there until it calls
// UnregisterNotify. We'll leak it. Hopefully, this won't happen often.
_dpaNotifs.AppendPtr(pne);
}
}
// static
void CALLBACK CSniffDrive::_UnregisterForNotifsHelper(ULONG_PTR ul)
{
PNPNOTIFENTRY* pne = (PNPNOTIFENTRY*)ul;
if (_dpaNotifs)
{
int cItem = _dpaNotifs.GetPtrCount();
for (int i = 0; i < cItem; ++i)
{
PNPNOTIFENTRY* pneTmp = _dpaNotifs.GetPtr(i);
if (pneTmp->hdevnotify == pne->hdevnotify)
{
CloseHandle(pne->hThread);
_dpaNotifs.DeletePtr(i);
pne->Release();
break;
}
}
}
}
// static
HRESULT CSniffDrive::HandleNotif(HDEVNOTIFY hdevnotify)
{
int cItem = _dpaNotifs ? _dpaNotifs.GetPtrCount() : 0;
for (int i = 0; i < cItem; ++i)
{
PNPNOTIFENTRY* pneTmp = _dpaNotifs.GetPtr(i);
if (pneTmp->hdevnotify == hdevnotify)
{
pneTmp->fStopSniffing = TRUE;
// We don't check the return value. The worst that will happen is that this
// fails and we'll return too early and PnP will prompt the user to reboot.
// Wait 2 minutes
WaitForSingleObjectEx(pneTmp->hThread, 2 * 60 * 1000, FALSE);
break;
}
}
return S_OK;
}
BOOL CSniffDrive::_FoundEverything()
{
return (_dwFound & DRIVEHAS_EVERYTHING) == DRIVEHAS_EVERYTHING;
}
CSniffDrive::CSniffDrive() : _dwFound(0)
{}
CSniffDrive::~CSniffDrive()
{}
void CMountPoint::SetAutorunStatus(BYTE* rgb, DWORD cbSize)
{
RSSetBinaryValue(NULL, TEXT("_AutorunStatus"), rgb, cbSize);
}
class CAutoPlayVerb : public IDropTarget
{
public:
CAutoPlayVerb() : _cRef(1) {}
// IUnknown refcounting
STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
STDMETHODIMP_(ULONG) AddRef(void)
{
return ++_cRef;
}
STDMETHODIMP_(ULONG) Release(void)
{
if (--_cRef > 0)
return _cRef;
delete this;
return 0;
}
// IDropTarget ***
STDMETHODIMP DragEnter(IDataObject *pdtobj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
STDMETHODIMP DragLeave(void);
STDMETHODIMP Drop(IDataObject *pdtobj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
protected:
LONG _cRef;
};
HRESULT CAutoPlayVerb::QueryInterface(REFIID riid, void **ppv)
{
static const QITAB qit[] =
{
QITABENT(CAutoPlayVerb, IDropTarget),
{ 0 },
};
return QISearch(this, qit, riid, ppv);
}
// IDropTarget::DragEnter
HRESULT CAutoPlayVerb::DragEnter(IDataObject *pdtobj, DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect)
{
*pdwEffect = DROPEFFECT_COPY;
return S_OK;;
}
// IDropTarget::DragOver
HRESULT CAutoPlayVerb::DragOver(DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect)
{
*pdwEffect = DROPEFFECT_COPY;
return S_OK;;
}
// IDropTarget::DragLeave
HRESULT CAutoPlayVerb::DragLeave(void)
{
return S_OK;
}
STDAPI CAutoPlayVerb_CreateInstance(IUnknown* pUnkOuter, REFIID riid, void **ppv)
{
HRESULT hr = E_OUTOFMEMORY;
*ppv = NULL;
// aggregation checking is handled in class factory
CAutoPlayVerb* p = new CAutoPlayVerb();
if (p)
{
hr = p->QueryInterface(riid, ppv);
p->Release();
}
return hr;
}
STDAPI SHChangeNotifyAutoplayDrive(PCWSTR pszDrive);
// IDropTarget::DragDrop
HRESULT CAutoPlayVerb::Drop(IDataObject *pdtobj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
{
*pdwEffect = DROPEFFECT_COPY;
// start the AutoPlayDialog
WCHAR szDrive[4];
HRESULT hr = PathFromDataObject(pdtobj, szDrive, ARRAYSIZE(szDrive));
if (SUCCEEDED(hr))
{
hr = SHChangeNotifyAutoplayDrive(szDrive);
}
return hr;
}
DWORD CALLBACK _AutorunPromptProc(void *pv)
{
WCHAR szDrive[4];
CMountPoint::DoAutorun(PathBuildRoot(szDrive, PtrToInt(pv)), AUTORUNFLAG_MENUINVOKED);
return 0;
}
void CMountPoint::DoAutorunPrompt(WPARAM iDrive)
{
SHCreateThread(_AutorunPromptProc, (void *)iDrive, CTF_COINIT | CTF_REF_COUNTED, NULL);
}
STDAPI_(void) Activate_RunDLL(HWND hwndStub, HINSTANCE hAppInstance, LPWSTR lpwszCmdLine, int nCmdShow)
{
DWORD dwProcessID;
HWND hwnd = GetShellWindow();
GetWindowThreadProcessId(hwnd, &dwProcessID);
AllowSetForegroundWindow(dwProcessID);
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "core/providers/cpu/activation/activations.h"
#include "activations.h"
namespace onnxruntime {
namespace contrib {
ONNX_CPU_OPERATOR_KERNEL(
ParametricSoftplus,
1,
KernelDefBuilder().MayInplace(0, 0).TypeConstraint("T", DataTypeImpl::GetTensorType<float>()),
ParametricSoftplus<float>);
ONNX_CPU_OPERATOR_KERNEL(
ScaledTanh,
1,
KernelDefBuilder().MayInplace(0, 0).TypeConstraint("T", DataTypeImpl::GetTensorType<float>()),
ScaledTanh<float>);
ONNX_CPU_OPERATOR_VERSIONED_KERNEL(
ThresholdedRelu,
1,
9,
KernelDefBuilder().MayInplace(0, 0).TypeConstraint("T", DataTypeImpl::GetTensorType<float>()),
ThresholdedRelu<float>);
ONNX_OPERATOR_KERNEL_EX(
Gelu,
kMSDomain,
1,
kCpuExecutionProvider,
KernelDefBuilder().MayInplace(0, 0).TypeConstraint("T", DataTypeImpl::GetTensorType<float>()),
Gelu<float>);
} // namespace contrib
} // namespace onnxruntime
|
//===-- Unittests for roundl ----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "include/math.h"
#include "src/math/roundl.h"
#include "utils/FPUtil/FPBits.h"
#include "utils/FPUtil/TestHelpers.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
#include "utils/UnitTest/Test.h"
using FPBits = __llvm_libc::fputil::FPBits<long double>;
namespace mpfr = __llvm_libc::testing::mpfr;
static const long double zero = FPBits::zero();
static const long double negZero = FPBits::negZero();
static const long double nan = FPBits::buildNaN(1);
static const long double inf = FPBits::inf();
static const long double negInf = FPBits::negInf();
// Zero tolerance; As in, exact match with MPFR result.
static constexpr mpfr::Tolerance tolerance{mpfr::Tolerance::floatPrecision, 0,
0};
TEST(RoundlTest, SpecialNumbers) {
EXPECT_FP_EQ(zero, __llvm_libc::roundl(zero));
EXPECT_FP_EQ(negZero, __llvm_libc::roundl(negZero));
EXPECT_FP_EQ(inf, __llvm_libc::roundl(inf));
EXPECT_FP_EQ(negInf, __llvm_libc::roundl(negInf));
ASSERT_NE(isnan(nan), 0);
ASSERT_NE(isnan(__llvm_libc::roundl(nan)), 0);
}
TEST(RoundlTest, RoundedNumbers) {
EXPECT_FP_EQ(1.0l, __llvm_libc::roundl(1.0l));
EXPECT_FP_EQ(-1.0l, __llvm_libc::roundl(-1.0l));
EXPECT_FP_EQ(10.0l, __llvm_libc::roundl(10.0l));
EXPECT_FP_EQ(-10.0l, __llvm_libc::roundl(-10.0l));
EXPECT_FP_EQ(1234.0l, __llvm_libc::roundl(1234.0l));
EXPECT_FP_EQ(-1234.0l, __llvm_libc::roundl(-1234.0l));
}
TEST(RoundlTest, Fractions) {
EXPECT_FP_EQ(1.0l, __llvm_libc::roundl(0.5l));
EXPECT_FP_EQ(-1.0l, __llvm_libc::roundl(-0.5l));
EXPECT_FP_EQ(0.0l, __llvm_libc::roundl(0.115l));
EXPECT_FP_EQ(-0.0l, __llvm_libc::roundl(-0.115l));
EXPECT_FP_EQ(1.0l, __llvm_libc::roundl(0.715l));
EXPECT_FP_EQ(-1.0l, __llvm_libc::roundl(-0.715l));
EXPECT_FP_EQ(1.0l, __llvm_libc::roundl(1.3l));
EXPECT_FP_EQ(-1.0l, __llvm_libc::roundl(-1.3l));
EXPECT_FP_EQ(2.0l, __llvm_libc::roundl(1.5l));
EXPECT_FP_EQ(-2.0l, __llvm_libc::roundl(-1.5l));
EXPECT_FP_EQ(2.0l, __llvm_libc::roundl(1.75l));
EXPECT_FP_EQ(-2.0l, __llvm_libc::roundl(-1.75l));
EXPECT_FP_EQ(10.0l, __llvm_libc::roundl(10.32l));
EXPECT_FP_EQ(-10.0l, __llvm_libc::roundl(-10.32l));
EXPECT_FP_EQ(11.0l, __llvm_libc::roundl(10.65l));
EXPECT_FP_EQ(-11.0l, __llvm_libc::roundl(-10.65l));
EXPECT_FP_EQ(1234.0l, __llvm_libc::roundl(1234.38l));
EXPECT_FP_EQ(-1234.0l, __llvm_libc::roundl(-1234.38l));
EXPECT_FP_EQ(1235.0l, __llvm_libc::roundl(1234.96l));
EXPECT_FP_EQ(-1235.0l, __llvm_libc::roundl(-1234.96l));
}
TEST(RoundlTest, InLongDoubleRange) {
using UIntType = FPBits::UIntType;
constexpr UIntType count = 10000000;
constexpr UIntType step = UIntType(-1) / count;
for (UIntType i = 0, v = 0; i <= count; ++i, v += step) {
long double x = FPBits(v);
if (isnan(x) || isinf(x))
continue;
ASSERT_MPFR_MATCH(mpfr::Operation::Round, x, __llvm_libc::roundl(x),
tolerance);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.