本文整理汇总了C++中InvalidStateException函数的典型用法代码示例。如果您正苦于以下问题:C++ InvalidStateException函数的具体用法?C++ InvalidStateException怎么用?C++ InvalidStateException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InvalidStateException函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: lock
void MpiLauncher::destroy(bool force)
{
pid_t pid=0;
int status=0;
string pidFile;
{
ScopedMutexLock lock(_mutex);
if (_pid == 0 || _waiting) {
throw (InvalidStateException(REL_FILE, __FUNCTION__, __LINE__)
<< " MPI launcher already destroyed");
}
_waiting = true;
pid = _pid;
status = _status;
pidFile = mpi::getLauncherPidFile(_installPath, _queryId, _launchId);
if (pid > 0) {
if (!force) {
scheduleKillTimer();
} else { // kill right away
boost::shared_ptr<boost::asio::deadline_timer> dummyTimer;
boost::system::error_code dummyErr;
handleKillTimeout(dummyTimer, dummyErr);
}
}
if (force) {
_inError=true;
}
}
if (pid < 0) {
completeLaunch(-pid, pidFile, status);
return;
}
bool rc = waitForExit(pid,&status);
assert(rc); rc=rc;
{
ScopedMutexLock lock(_mutex);
if (!_waiting || pid != _pid) {
throw InvalidStateException(REL_FILE, __FUNCTION__, __LINE__)
<< " MPI launcher is corrupted after collecting process exit code";
}
_pid = -pid;
_status = status;
if (_killTimer) {
size_t n = _killTimer->cancel();
assert(n<2); n=n;
}
}
completeLaunch(pid, pidFile, status);
}
开发者ID:hansmire,项目名称:scidb-osx-12.10-mountain-lion,代码行数:52,代码来源:MPILauncher.cpp
示例2: InvalidStateException
void SharedFile::truncate(uint64_t size, bool force)
{
if (!_file) {
throw InvalidStateException(REL_FILE, __FUNCTION__, __LINE__);
}
if (_region && !force) {
throw InvalidStateException(REL_FILE, __FUNCTION__, __LINE__);
}
_region.reset();
if (::truncate(getName().c_str(), size) != 0) {
int err = errno;
throw SystemErrorException(err, REL_FILE, __FUNCTION__, __LINE__);
}
}
开发者ID:cerbo,项目名称:scidb,代码行数:14,代码来源:SharedMemoryIpc.cpp
示例3: throw
Pkcs7SignedData* Pkcs7SignedDataBuilder::doFinal()
throw (InvalidStateException, Pkcs7Exception)
{
int rc;
Pkcs7SignedData *ret;
if (this->state != Pkcs7Builder::UPDATE)
{
throw InvalidStateException("Pkcs7SignedDataBuilder::dofinal");
}
rc = BIO_flush(this->p7bio);
if (!rc)
{
BIO_free(this->p7bio);
this->p7bio = NULL;
this->state = Pkcs7Builder::NO_INIT;
throw Pkcs7Exception(Pkcs7Exception::INTERNAL_ERROR, "Pkcs7SignedDataBuilder::dofinal", true);
}
rc = PKCS7_dataFinal(this->pkcs7, this->p7bio);
if (!rc)
{
BIO_free(this->p7bio);
this->p7bio = NULL;
PKCS7_free(this->pkcs7);
this->pkcs7 = NULL;
this->state = Pkcs7Builder::NO_INIT;
throw Pkcs7Exception(Pkcs7Exception::INTERNAL_ERROR, "Pkcs7SignedDataBuilder::dofinal", true);
}
this->state = Pkcs7Builder::NO_INIT;
BIO_free(this->p7bio);
this->p7bio = NULL;
ret = new Pkcs7SignedData(this->pkcs7);
this->pkcs7 = NULL;
return ret;
}
开发者ID:GNakayama,项目名称:libcryptosec,代码行数:35,代码来源:Pkcs7SignedDataBuilder.cpp
示例4: InvalidStateException
void AppLayer::OnSendResult(bool aSuccess)
{
if(!mSending)
throw InvalidStateException(LOCATION, "No Active Send");
assert(mSendQueue.size() > 0);
mSending = false;
FunctionCodes func = mSendQueue.front()->GetFunction();
mSendQueue.pop_front();
if(func == FC_CONFIRM) {
assert(mConfirmSending);
mConfirmSending = false;
}
else {
if(aSuccess) {
if(func == FC_UNSOLICITED_RESPONSE) mUnsolicited.OnSendSuccess();
else mSolicited.OnSendSuccess();
}
else {
if(func == FC_UNSOLICITED_RESPONSE) mUnsolicited.OnSendFailure();
else mSolicited.OnSendFailure();
}
}
this->CheckForSend();
}
开发者ID:diverger,项目名称:dnp3,代码行数:28,代码来源:AppLayer.cpp
示例5: throw
void MpiSlaveProxy::waitForExit(std::shared_ptr<MpiOperatorContext>& ctx)
{
if (!_connection) {
throw (InvalidStateException(REL_FILE, __FUNCTION__, __LINE__)
<< "No connection to MPI slave");
}
LOG4CXX_DEBUG(logger, "MpiSlaveProxy::waitForExit: launchId="<<_launchId);
MpiOperatorContext::LaunchErrorChecker errChecker =
boost::bind(&checkTimeout,
mpi::getTimeInSecs(),
static_cast<double>(_MPI_SLAVE_RESPONSE_TIMEOUT),
_1, _2);
std::shared_ptr<scidb::ClientMessageDescription> msg = ctx->popMsg(_launchId, errChecker);
assert(msg);
LOG4CXX_DEBUG(logger, "MpiSlaveProxy::waitForExit: "
<<" ctx = " << msg->getClientContext().get()
<<", msg type = "<< msg->getMessageType()
<<", queryID = "<<msg->getQueryId());
if (msg->getMessageType() != scidb::SYSTEM_NONE_MSG_ID) {
throw (SYSTEM_EXCEPTION(SCIDB_SE_INTERNAL, SCIDB_LE_UNKNOWN_ERROR)
<< "MPI slave returned invalid status");
}
assert(!msg->getClientContext());
_connection.reset();
}
开发者ID:suhailrehman,项目名称:scidb,代码行数:30,代码来源:MPISlaveProxy.cpp
示例6: InvalidStateException
void LinkLayer::OnLowerLayerUp()
{
if(mIsOnline)
throw InvalidStateException(LOCATION, "LowerLayerUp");
mIsOnline = true;
if(mpUpperLayer) mpUpperLayer->OnLowerLayerUp();
}
开发者ID:AlanMarshall,项目名称:dnp3-1,代码行数:7,代码来源:LinkLayer.cpp
示例7: InvalidStateException
/** \brief Check whether the collection is valid.
*
* This function verifies that the collection is valid. If not, an
* exception is raised. Many other functions from the various collection
* functions are calling this function before accessing data.
*
* \exception InvalidStateException
* This exception is raised if the m_valid field is currently false and
* thus most of the collection data is considered invalid.
*/
void FileCollection::mustBeValid() const
{
if(!m_valid)
{
throw InvalidStateException("Attempted to access an invalid FileCollection");
}
}
开发者ID:pgquiles,项目名称:zipios,代码行数:17,代码来源:filecollection.cpp
示例8: InvalidStateException
/**********************************************************************************************
*
* ReadReference
*
* Reference = EntityReference | CharacterReference ;
*
* CharacterReference = "&#" [0-9]+ ";" | "&#x" [0-9a-fA-F]+ ";" ;
*
* EntityReference = "<" | "&" | ">" | """ | "'" ;
*
*********************************************************************************************/
void XMLParser::ReadReference () {
if (current == '&') ReadCharacter ();
else throw InvalidStateException ();
if (current == '#') {
if (current == 'x') {
/* hexadecimal encoded unicode character. */
while (ReadCharacter ()) {
// TODO ...
if (current == ';') break;
}
} else {
/* decimal encoded unicode character. */
do {
// TODO ...
if (current == ';') break;
} while (ReadCharacter ());
}
} else {
/* named entity */
do {
// TODO ...
if (current == ';') break;
} while (ReadCharacter ());
}
}
开发者ID:monika297,项目名称:sayl,代码行数:39,代码来源:XMLScanner.cpp
示例9: GetWidth
//=================================================================
// Texture3D::GetVolumeData
//---------------------------------------
void Texture3D::GetVolumeData(VolumeData &volume) const
{
if( Bind() )
{
// Make sure our volume has correct data size
// we may have to recreate it
UInt32 ownWidth = GetWidth();
UInt32 ownHeight = GetHeight();
UInt32 ownDepth = GetWidth();
if( ownWidth != volume.GetWidth()
|| ownHeight != volume.GetHeight()
|| ownDepth != volume.GetDepth() )
{
volume.Create( ownWidth, ownHeight, ownDepth );
}
UInt8 *volumeData = volume.GetData();
glGetTexImage(
GL_TEXTURE_3D,
MIP_MAP_LEVEL_0,
GL_RGBA,
GL_UNSIGNED_BYTE,
(GLvoid*) volumeData
);
}
else
{
throw InvalidStateException();
}
}
开发者ID:SuperIzzo,项目名称:Vroom3D,代码行数:36,代码来源:Texture3D.cpp
示例10: Read
APDU MockAppLayer::Read()
{
if(mFragments.size() == 0) throw InvalidStateException(LOCATION, "no more fragments");
APDU frag = mFragments.front();
frag.Interpret();
mFragments.pop_front();
return frag;
}
开发者ID:diverger,项目名称:dnp3,代码行数:8,代码来源:MockAppLayer.cpp
示例11: Get
const T& Get() const {
if (!m_data) {
throw InvalidStateException("Object is empty.");
}
if (std::type_index(typeid(T)) != m_data->Type()) {
throw std::bad_cast("Types don't match.");
}
return *reinterpret_cast<const T*>(m_data->Get());
}
开发者ID:petiaccja,项目名称:Inline-Engine,代码行数:9,代码来源:Any.hpp
示例12: switch
bool ControlTaskBase::GetSelectBit()
{
switch(mState) {
case(SELECT): return true;
case(OPERATE): return false;
default:
throw InvalidStateException(LOCATION, "INVALID");
}
}
开发者ID:diverger,项目名称:dnp3,代码行数:9,代码来源:ControlTasks.cpp
示例13: ReadFunction
FunctionCodes MockAppLayer::ReadFunction()
{
if(mFragments.size() == 0) throw InvalidStateException(LOCATION, "No more fragments");
else {
FunctionCodes func = mFragments.front().GetFunction();
mFragments.pop_front();
return func;
}
}
开发者ID:cverges,项目名称:dnp3,代码行数:9,代码来源:MockAppLayer.cpp
示例14: InvalidStateException
/** \brief Define the level of compression to use by this FileEntry.
*
* This function saves the level of compression the library should use
* to compress the file before saving it in the output file.
*
* \note
* If the StorageMethod is set to STORED, then the compression level is
* ignored, but it is left unchanged.
*
* \exception InvalidStateException
* This function raises this exception if the specified level is out of
* the allowed range.
*
* \param[in] level The compression level to use to compress the file data.
*/
void FileEntry::setLevel(CompressionLevel level)
{
if(level < COMPRESSION_LEVEL_DEFAULT || level > COMPRESSION_LEVEL_MAXIMUM)
{
throw InvalidStateException("level must be between COMPRESSION_LEVEL_DEFAULT and COMPRESSION_LEVEL_MAXIMUM");
}
if(isDirectory())
{
if(level >= COMPRESSION_LEVEL_MINIMUM)
{
throw InvalidStateException("directories cannot be marked with a compression level other than COMPRESSION_LEVEL_NONE (defaults will also work");
}
m_compression_level = COMPRESSION_LEVEL_NONE;
}
else
{
m_compression_level = level;
}
}
开发者ID:pgquiles,项目名称:zipios,代码行数:34,代码来源:fileentry.cpp
示例15: InvalidStateException
/** \brief Write the ZipEndOfCentralDirectory structure to a stream.
*
* This function writes the currently defined end of central
* directory to disk. This entry is expected to be written at
* the very end of a Zip archive file.
*
* \note
* If the output pointer is not valid, the function will throw
* via the various zipWrite() it uses.
*
* \note
* The function does not change the output pointer of the stream
* before writing to it.
*
* \exception FileCollectionException
* This function throws this exception if the data cannot be saved. In
* general this means there are too many entries, the size is too large
* or the comment is more than 64Kb (some of which will be resolved with
* Zip64 support.)
*
* \param[in] os The output stream where the data is to be saved.
*/
void ZipEndOfCentralDirectory::write(std::ostream& os)
{
/** \TODO
* Add support for 64 bit Zip archive. This would allow for pretty
* much all the following conditions to be dropped out.
*/
if(m_zip_comment.length() > 65535)
{
throw InvalidStateException("the Zip archive comment is too large");
}
if(m_central_directory_entries > 65535)
{
throw InvalidStateException("the number of entries in the Zip archive is too large");
}
// Solaris defines _ILP32 for 32 bit platforms
#if !defined(_ILP32)
if(m_central_directory_size >= 0x100000000UL
|| m_central_directory_offset >= 0x100000000L)
{
throw FileCollectionException("the Zip archive size or offset are too large"); // LCOV_EXCL_LINE
}
#endif
uint16_t const disk_number(0);
uint16_t const central_directory_entries(m_central_directory_entries);
uint32_t const central_directory_size(m_central_directory_size);
uint32_t const central_directory_offset(m_central_directory_offset);
uint16_t const comment_len(m_zip_comment.length());
// the total number of entries, across all disks is the same in our
// case so we use one number for both fields
zipWrite(os, g_signature); // 32
zipWrite(os, disk_number); // 16
zipWrite(os, disk_number); // 16
zipWrite(os, central_directory_entries); // 16
zipWrite(os, central_directory_entries); // 16
zipWrite(os, central_directory_size); // 32
zipWrite(os, central_directory_offset); // 32
zipWrite(os, comment_len); // 16
zipWrite(os, m_zip_comment); // string
}
开发者ID:pgquiles,项目名称:zipios,代码行数:64,代码来源:zipendofcentraldirectory.cpp
示例16: throw
void Hmac::update(ByteArray &data) throw (HmacException, InvalidStateException) {
if (this->state == Hmac::NO_INIT)
{
throw InvalidStateException("Hmac::update");
}
int rc = HMAC_Update( &this->ctx, data.getDataPointer(), data.size() );
if (!rc)
{
throw HmacException(HmacException::CTX_UPDATE, "Hmac::update");
}
this->state = Hmac::UPDATE;
}
开发者ID:GNakayama,项目名称:libcryptosec,代码行数:12,代码来源:Hmac.cpp
示例17: InvalidStateException
void ClassPoll::ConfigureRequest(APDU& arAPDU)
{
if (mClassMask == PC_INVALID) {
throw InvalidStateException(LOCATION, "Class mask has not been set");
}
arAPDU.Set(FC_READ);
if (mClassMask & PC_CLASS_0) arAPDU.DoPlaceholderWrite(Group60Var1::Inst());
if (mClassMask & PC_CLASS_1) arAPDU.DoPlaceholderWrite(Group60Var2::Inst());
if (mClassMask & PC_CLASS_2) arAPDU.DoPlaceholderWrite(Group60Var3::Inst());
if (mClassMask & PC_CLASS_3) arAPDU.DoPlaceholderWrite(Group60Var4::Inst());
}
开发者ID:sentient-energy,项目名称:emsw-opendnp3-mirror,代码行数:12,代码来源:DataPoll.cpp
示例18: LOG_BLOCK
void FreeFormPoll::ConfigureRequest(APDU& arAPDU)
{
LOG_BLOCK(LEV_DEBUG, "FreeFormPoll::ConfigureRequest");
if (this->GetClassMask() == PC_INVALID) {
throw InvalidStateException(LOCATION, "Class mask has not been set");
}
arAPDU.Set(FC_READ);
std::lock_guard<std::mutex> guard{ffInputPoints_mutex_};
if ((this->GetClassMask() & PC_CLASS_0) && ffInputPoints.size() > 0) {
for (std::pair<apl::DataTypes, std::vector<uint32_t>> element : ffInputPoints)
{
if (element.second.size() <= 0)
continue; //should not come here
if (element.first == apl::DataTypes::DT_ANALOG) {
for (int ind=0; ind<element.second.size(); ++ind) {
size_t index = element.second.at(ind);
ObjectWriteIterator i = arAPDU.WriteContiguous(Group30Var1::Inst(), index, index, QC_1B_START_STOP );
}
}
if (element.first == apl::DataTypes::DT_BINARY) {
for (int ind=0; ind<element.second.size(); ++ind) {
size_t index = element.second.at(ind);
ObjectWriteIterator i = arAPDU.WriteContiguous(Group1Var2::Inst(), index, index, QC_1B_START_STOP );
}
}
if (element.first == apl::DataTypes::DT_COUNTER) {
for (int ind=0; ind<element.second.size(); ++ind) {
size_t index = element.second.at(ind);
ObjectWriteIterator i = arAPDU.WriteContiguous(Group20Var1::Inst(), index, index, QC_1B_START_STOP );
}
}
if (element.first == apl::DataTypes::DT_CONTROL_STATUS) {
for (int ind=0; ind<element.second.size(); ++ind) {
size_t index = element.second.at(ind);
ObjectWriteIterator i = arAPDU.WriteContiguous(Group10Var2::Inst(), index, index, QC_1B_START_STOP );
}
}
if (element.first == apl::DataTypes::DT_SETPOINT_STATUS) {
for (int ind=0; ind<element.second.size(); ++ind) {
size_t index = element.second.at(ind);
ObjectWriteIterator i = arAPDU.WriteContiguous(Group40Var1::Inst(), index, index, QC_1B_START_STOP );
}
}
}
}
}
开发者ID:sentient-energy,项目名称:emsw-opendnp3-mirror,代码行数:51,代码来源:DataPoll.cpp
示例19: switch
void AMS_Waiting::OnPartialResponse(Master* c, const APDU& arAPDU)
{
switch(c->mpTask->OnPartialResponse(arAPDU)) {
case(TR_FAIL):
this->ChangeState(c, AMS_Idle::Inst());
c->mpScheduledTask->OnComplete(false);
break;
case(TR_CONTINUE):
c->StartTask(c->mpTask, false);
break;
default:
throw InvalidStateException(LOCATION, "Tasks must return FAIL or CONTINUE in on partial responses");
}
}
开发者ID:diverger,项目名称:dnp3,代码行数:14,代码来源:MasterStates.cpp
示例20: InvalidStateException
istream *ZipFile::getInputStream( const string &entry_name,
MatchPath matchpath ) {
if ( ! _valid )
throw InvalidStateException( "Attempt to use an invalid ZipFile" ) ;
ConstEntryPointer ent = getEntry( entry_name, matchpath ) ;
if ( ent == 0 )
return 0 ;
else
return new ZipInputStream( _filename,
static_cast< const ZipCDirEntry * >( ent.get() )->
getLocalHeaderOffset() + _vs.startOffset() ) ;
}
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:14,代码来源:zipfile.cpp
注:本文中的InvalidStateException函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论