本文整理汇总了C++中ABCA_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ ABCA_ASSERT函数的具体用法?C++ ABCA_ASSERT怎么用?C++ ABCA_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ABCA_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ABCA_ASSERT
//-*****************************************************************************
std::size_t XformSample::addOp( const XformOp &iOp )
{
if ( ! m_hasBeenRead )
{
ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 1,
"Cannot mix addOp() and set<Foo>() methods." );
m_setWithOpStack = 1;
m_ops.push_back( iOp );
return m_ops.size() - 1;
}
else
{
std::size_t ret = m_opIndex;
ABCA_ASSERT( iOp.getType() == m_ops[ret].getType(),
"Cannot update mismatched op-type in already-setted "
<< "XformSample!" );
ABCA_ASSERT( m_setWithOpStack == 1,
"Cannot mix addOp() and set<Foo>() methods." );
m_ops[ret] = iOp;
m_opIndex = ++m_opIndex % m_ops.size();
return ret;
}
}
示例2: m_parent
//-*****************************************************************************
CprImpl::CprImpl( AbcA::CompoundPropertyReaderPtr iParent,
Ogawa::IGroupPtr iGroup,
PropertyHeaderPtr iHeader,
std::size_t iThreadId,
const std::vector< AbcA::MetaData > & iIndexedMetaData )
: m_parent( iParent )
, m_header( iHeader )
{
ABCA_ASSERT( m_parent, "Invalid parent in CprImpl(Compound)" );
ABCA_ASSERT( m_header, "invalid header in CprImpl(Compound)" );
AbcA::PropertyType pType = m_header->header.getPropertyType();
if ( pType != AbcA::kCompoundProperty )
{
ABCA_THROW( "Tried to create compound property with the wrong "
"property type: " << pType );
}
// Set object.
AbcA::ObjectReaderPtr optr = m_parent->getObject();
ABCA_ASSERT( optr, "Invalid object in CprImpl::CprImpl(Compound)" );
m_object = optr;
m_data.reset( new CprData( iGroup, iThreadId, *( m_object->getArchive() ),
iIndexedMetaData ) );
}
示例3: op
//-*****************************************************************************
void XformSample::setZRotation( const double iAngleInDegrees )
{
XformOp op( kRotateZOperation, kRotateHint );
op.setChannelValue( 0, iAngleInDegrees );
if ( ! m_hasBeenRead )
{
ABCA_ASSERT( m_setWithOpStack == 0 || m_setWithOpStack == 2,
"Cannot mix addOp() and set<Foo>() methods." );
m_setWithOpStack = 2;
m_ops.push_back( op );
}
else
{
std::size_t ret = m_opIndex;
ABCA_ASSERT( m_setWithOpStack == 2,
"Cannot mix addOp() and set<Foo>() methods." );
ABCA_ASSERT( op.getType() == m_ops[ret].getType(),
"Cannot update mismatched op-type in already-setted "
<< "XformSample!" );
m_ops[ret] = op;
m_opIndex = ++m_opIndex % m_ops.size();
}
}
示例4: CopyWrittenArray
//-*****************************************************************************
void
CopyWrittenArray( hid_t iGroup,
const std::string &iName,
WrittenArraySampleIDPtr iRef )
{
ABCA_ASSERT( ( bool )iRef,
"CopyWrittenArray() passed a bogus ref" );
hid_t fid = H5Iget_file_id(iGroup);
ABCA_ASSERT( fid >= 0,
"CopyWrittenArray() Could not get file ID from iGroup" );
hid_t did = H5Dopen( fid,
iRef->getObjectLocation().c_str(), H5P_DEFAULT );
DsetCloser dcloser(did);
// We have a reference. Create a link to it.
// We are manually getting the source dataset instead of using
// fid and iName because of a bug in HDF5 1.8.5 and earlier.
// Files written using that approach would sometimes be corrupted.
herr_t status = H5Lcreate_hard( did,
".",
iGroup,
iName.c_str(),
H5P_DEFAULT,
H5P_DEFAULT );
H5Fclose( fid );
ABCA_ASSERT( status >= 0,
"H5Lcreate_hard failed!" << std::endl
<< "Dset obj id: " << did << std::endl
<< "Link loc id: " << iGroup << std::endl
<< "Link name: " << iName );
}
示例5: ReadDataSetDimensions
//-*****************************************************************************
// Get the dimensions directly off of the dataspace on the dataset
// This isn't suitable for string and wstring
void
ReadDataSetDimensions( hid_t iParent,
const std::string &iName,
hsize_t iExtent,
Dimensions &oDims )
{
// Open the data set.
hid_t dsetId = H5Dopen( iParent, iName.c_str(), H5P_DEFAULT );
ABCA_ASSERT( dsetId >= 0, "Cannot open dataset: " << iName );
DsetCloser dsetCloser( dsetId );
// Read the data space.
hid_t dspaceId = H5Dget_space( dsetId );
ABCA_ASSERT( dspaceId >= 0, "Could not get dataspace for dataSet: "
<< iName );
DspaceCloser dspaceCloser( dspaceId );
H5S_class_t dspaceClass = H5Sget_simple_extent_type( dspaceId );
if ( dspaceClass == H5S_SIMPLE )
{
// Get the dimensions
int rank = H5Sget_simple_extent_ndims( dspaceId );
ABCA_ASSERT( rank == 1, "H5Sget_simple_extent_ndims() must be 1." );
hsize_t hdim = 0;
rank = H5Sget_simple_extent_dims( dspaceId, &hdim, NULL );
oDims.setRank(1);
oDims[0] = hdim / iExtent;
}
else
{
oDims.setRank(1);
oDims[0] = 0;
}
}
示例6: WriteStringsT
void
WriteStringsT( hid_t iParent,
const std::string &iAttrName,
size_t iNumStrings,
const StringT *iStrings )
{
// Validate
ABCA_ASSERT( iNumStrings > 0, "Degenerate num strings in WriteStringsT" );
ABCA_ASSERT( iStrings, "Degenerate strings buffer in WriteStringsT" );
// Compact the strings.
std::vector<CharT> charBuffer;
CompactStrings( iStrings, iNumStrings, charBuffer );
// Create the dataspace.
size_t len = charBuffer.size();
assert( len >= iNumStrings );
Dimensions dims( len );
HDimensions hdims( dims );
hid_t dspaceId = H5Screate_simple( hdims.rank(), hdims.rootPtr(), NULL );
DspaceCloser dspaceCloser( dspaceId );
ABCA_ASSERT( dspaceId >= 0,
"WriteStringsT() Failed in dataspace constructor" );
// Create the attribute.
WriteDataToAttr( iParent, dspaceId, iAttrName,
GetFileDtype<CharT>(), GetNativeDtype<CharT>(),
( const void * )&charBuffer.front() );
// That's it!
}
示例7: BaseCpwImpl
//-*****************************************************************************
// With the compound property writer as an input.
CpwImpl::CpwImpl( AbcA::CompoundPropertyWriterPtr iParent,
hid_t iParentGroup,
const std::string & iName,
const AbcA::MetaData & iMeta )
: BaseCpwImpl( iParentGroup )
, m_parent( iParent )
, m_header( new AbcA::PropertyHeader(iName, iMeta) )
{
// Check the validity of all inputs.
ABCA_ASSERT( m_parent, "Invalid parent" );
ABCA_ASSERT( m_header, "Invalid property header" );
if ( m_header->getPropertyType() != AbcA::kCompoundProperty )
{
ABCA_THROW( "Tried to create compound property with the wrong "
"property type: " << m_header->getPropertyType() );
}
// Set the object.
AbcA::ObjectWriterPtr optr = m_parent->getObject();
ABCA_ASSERT( optr, "Invalid object" );
m_object = optr;
// Write the property header.
WritePropertyInfo( iParentGroup, m_header->getName(),
m_header->getPropertyType(), m_header->getDataType(),
false, 0, 0, 0, 0 );
WriteMetaData( iParentGroup, m_header->getName() + ".meta",
m_header->getMetaData() );
}
示例8: BaseCpwImpl
//-*****************************************************************************
// With the compound property writer as an input.
CpwImpl::CpwImpl( AbcA::CompoundPropertyWriterPtr iParent,
hid_t iParentGroup,
PropertyHeaderPtr iHeader )
: BaseCpwImpl( iParentGroup )
, m_parent( iParent )
, m_header( iHeader )
{
// Check the validity of all inputs.
ABCA_ASSERT( m_parent, "Invalid parent" );
ABCA_ASSERT( m_header, "Invalid property header" );
if ( m_header->getPropertyType() != AbcA::kCompoundProperty )
{
ABCA_THROW( "Tried to create compound property with the wrong "
"property type: " << m_header->getPropertyType() );
}
// Set the object.
AbcA::ObjectWriterPtr optr = m_parent->getObject();
ABCA_ASSERT( optr, "Invalid object" );
m_object = optr;
// Write the property header.
WritePropertyHeaderExceptTime( iParentGroup,
m_header->getName(),
*m_header );
}
示例9: m_object
//-*****************************************************************************
CprImpl::CprImpl( AbcA::ObjectReaderPtr iObject,
CprDataPtr iData )
: m_object( iObject )
, m_data( iData )
{
ABCA_ASSERT( m_object, "Invalid object in CprImpl(Object)" );
ABCA_ASSERT( m_data, "Invalid data in CprImpl(Object)" );
m_header.reset( new AbcA::PropertyHeader( "", m_object->getMetaData() ) );
}
示例10: m_fileName
//-*****************************************************************************
// SCENE CLASS
//-*****************************************************************************
Scene::Scene( const std::string &fileName, bool verbose )
: m_fileName( fileName )
, m_minTime( ( chrono_t )FLT_MAX )
, m_maxTime( ( chrono_t )-FLT_MAX )
{
Timer playbackTimer;
Alembic::AbcCoreFactory::IFactory factory;
m_archive = factory.getArchive( fileName );
m_topObject = IObject( m_archive, kTop );
if ( verbose )
std::cout << "Opened archive and top object, creating drawables."
<< std::endl;
m_drawable.reset( new IObjectDrw( m_topObject, false ) );
ABCA_ASSERT( m_drawable->valid(),
"Invalid drawable for archive: " << fileName );
if ( verbose )
std::cout << "Created drawables, getting time range." << std::endl;
m_minTime = m_drawable->getMinTime();
m_maxTime = m_drawable->getMaxTime();
if ( m_minTime <= m_maxTime ) {
if ( verbose )
std::cout << "\nMin Time: " << m_minTime << " seconds " << std::endl
<< "Max Time: " << m_maxTime << " seconds " << std::endl
<< "\nLoading min time." << std::endl;
m_drawable->setTime( m_minTime );
}
else {
if ( verbose )
std::cout << "\nConstant Time." << std::endl
<< "\nLoading constant sample." << std::endl;
m_minTime = m_maxTime = 0.0;
m_drawable->setTime( 0.0 );
}
ABCA_ASSERT( m_drawable->valid(),
"Invalid drawable after reading start time" );
if ( verbose )
std::cout << "Done opening archive. Elapsed CPU time: "
<< ((float)playbackTimer.elapsed()) / CLOCKS_PER_SEC << " seconds." << std::endl;
// Bounds have been formed!
m_bounds = m_drawable->getBounds();
if ( verbose )
std::cout << "Bounds at min time: " << m_bounds.min << " to "
<< m_bounds.max << std::endl;
}
示例11: m_archive
OwImpl::OwImpl( AbcA::ArchiveWriterPtr iArchive,
OwDataPtr iData,
const AbcA::MetaData & iMetaData )
: m_archive( iArchive )
, m_header( new AbcA::ObjectHeader( "ABC", "/", iMetaData ) )
, m_data( iData )
, m_index( 0 )
{
ABCA_ASSERT( m_archive, "Invalid archive" );
ABCA_ASSERT( m_data, "Invalid data" );
}
示例12: m_children
//-*****************************************************************************
OrData::OrData( ObjectHeaderPtr iHeader,
H5Node & iParentGroup,
int32_t iArchiveVersion )
: m_children( NULL )
{
ABCA_ASSERT( iHeader, "Invalid header" );
ABCA_ASSERT( iParentGroup.isValidObject(), "Invalid group" );
m_group = OpenGroup( iParentGroup, iHeader->getName().c_str() );
ABCA_ASSERT( m_group.isValidObject(),
"Could not open object group: "
<< iHeader->getFullName() );
std::vector<std::string> objNames;
herr_t status = H5Literate( m_group.getObject(),
H5_INDEX_CRT_ORDER,
H5_ITER_INC,
NULL,
VisitAllLinksCB,
( void * )&objNames );
ABCA_ASSERT( status >= 0,
"OrData::OrData: H5Literate failed" );
std::vector < std::string >::iterator namesIt;
uint32_t i = 0;
if ( !objNames.empty() )
{
m_children = new Child[ objNames.size() ];
}
std::string parentFullName = iHeader->getFullName();
if ( parentFullName != "/" )
{
parentFullName += "/";
}
for ( namesIt = objNames.begin(); namesIt != objNames.end();
++namesIt, ++i )
{
m_childrenMap[ *namesIt ] = i;
m_children[i].header.reset( new AbcA::ObjectHeader( *namesIt,
parentFullName + *namesIt, AbcA::MetaData() ) );
m_children[i].loadedMetaData = false;
}
m_oldGroup = m_group;
m_data = Alembic::Util::shared_ptr<CprData>(
new CprData( m_group, iArchiveVersion, ".prop" ) );
}
示例13: m_archive
//-*****************************************************************************
ArImpl::ArImpl( const std::vector< std::istream * > & iStreams )
: m_archive( iStreams )
, m_header( new AbcA::ObjectHeader() )
, m_manager( iStreams.size() )
{
ABCA_ASSERT( m_archive.isValid(),
"Could not open as Ogawa file from provided streams." );
ABCA_ASSERT( m_archive.isFrozen(),
"Ogawa streams not cleanly closed while being written. " );
init();
}
示例14: m_fileName
//-*****************************************************************************
ArImpl::ArImpl( const std::string &iFileName,
std::size_t iNumStreams )
: m_fileName( iFileName )
, m_archive( iFileName, iNumStreams )
, m_header( new AbcA::ObjectHeader() )
, m_manager( iNumStreams )
{
ABCA_ASSERT( m_archive.isValid(),
"Could not open as Ogawa file: " << m_fileName );
ABCA_ASSERT( m_archive.isFrozen(),
"Ogawa file not cleanly closed while being written: " << m_fileName );
init();
}
示例15: ReadTimeSamples
//-*****************************************************************************
void
ReadTimeSamples( hid_t iParent,
std::vector < AbcA::TimeSamplingPtr > & oTimeSamples )
{
oTimeSamples.clear();
// add the intrinsic default sampling
AbcA::TimeSamplingPtr ts( new AbcA::TimeSampling() );
oTimeSamples.push_back( ts );
uint32_t i = 1;
AbcA::TimeSamplingType tst;
std::string tstname = "1";
// keep trying to read till we can't find anymore
while ( ReadTimeSamplingType( iParent, tstname, tst ) )
{
// try to open the time samples attribute
std::string timeName = tstname + ".time";
hid_t aid = H5Aopen( iParent, timeName.c_str(), H5P_DEFAULT );
ABCA_ASSERT( aid >= 0,
"Couldn't open time samples named: " << timeName );
AttrCloser attrCloser( aid );
// figure out how big it is
hid_t sid = H5Aget_space( aid );
ABCA_ASSERT( sid >= 0,
"Couldn't get dataspace for time samples: " << timeName );
DspaceCloser dspaceCloser( sid );
hssize_t numPoints = H5Sget_simple_extent_npoints( sid );
ABCA_ASSERT( numPoints > 0, "No time samples data: " << timeName );
std::vector < chrono_t > times(numPoints);
// do the read
herr_t status = H5Aread( aid, H5T_NATIVE_DOUBLE, &(times.front()) );
ABCA_ASSERT( status >= 0, "Can't read time samples: " << timeName );
// create the TimeSampling and add it to our vector
ts.reset( new AbcA::TimeSampling(tst, times) );
oTimeSamples.push_back( ts );
// increment to try and read the next one
i++;
std::stringstream strm;
strm << i;
tstname = strm.str();
}
}