本文整理汇总了C++中iceinternal::InstancePtr类的典型用法代码示例。如果您正苦于以下问题:C++ InstancePtr类的具体用法?C++ InstancePtr怎么用?C++ InstancePtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InstancePtr类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stream
void
ByteMapKeyCodec::read(::Ice::Int& v, const Freeze::Key& bytes, const ::Ice::CommunicatorPtr& communicator, const Ice::EncodingVersion& encoding)
{
IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);
IceInternal::BasicStream stream(instance.get(), encoding, &bytes[0], &bytes[0] + bytes.size());
stream.read(v);
}
示例2: stream
void
Freeze::ObjectStoreBase::unmarshal(Identity& ident,
const Key& bytes,
const CommunicatorPtr& communicator,
const EncodingVersion& encoding)
{
IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);
IceInternal::BasicStream stream(instance.get(), encoding, &bytes[0], &bytes[0] + bytes.size());
stream.read(ident);
}
示例3: PluginInitializationException
Ice::ThreadHookPlugin::ThreadHookPlugin(const CommunicatorPtr& communicator, const ThreadNotificationPtr& threadHook)
{
if(communicator == 0)
{
throw PluginInitializationException(__FILE__, __LINE__, "Communicator cannot be null");
}
IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);
instance->setThreadHook(threadHook);
}
示例4: PluginInitializationException
Ice::LoggerPlugin::LoggerPlugin(const CommunicatorPtr& communicator, const LoggerPtr& logger)
{
if(communicator == 0)
{
throw PluginInitializationException(__FILE__, __LINE__, "Communicator cannot be null");
}
if(logger == 0)
{
throw PluginInitializationException(__FILE__, __LINE__, "Logger cannot be null");
}
IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);
instance->setLogger(logger);
}
示例5: query
IceGrid::ApplicationInfo
SqlStringApplicationInfoDict::find(const DatabaseConnectionPtr& connection,
const string& name)
{
QSqlQuery query(connection->sqlConnection());
string queryString = "SELECT * FROM ";
queryString += _table;
queryString += " WHERE name = ?;";
query.prepare(queryString.c_str());
query.bindValue(0, name.c_str());
if(!query.exec())
{
throwDatabaseException(__FILE__, __LINE__, query.lastError());
}
if(query.next())
{
IceGrid::ApplicationInfo info;
info.uuid = query.value(1).toString().toStdString();
info.createTime = query.value(2).toLongLong();
info.createUser = query.value(3).toString().toStdString();
info.updateTime = query.value(4).toLongLong();
info.updateUser = query.value(5).toString().toStdString();
info.revision = query.value(6).toInt();
QByteArray bytes = query.value(7).toByteArray();
IceInternal::InstancePtr instance = IceInternal::getInstance(_communicator);
IceInternal::BasicStream stream(instance.get());
stream.b.resize(bytes.size());
::memcpy(&stream.b[0], bytes.data(), bytes.size());
stream.i = stream.b.begin();
stream.startReadEncaps();
info.descriptor.__read(&stream);
stream.readPendingObjects();
stream.endReadEncaps();
return info;
}
else
{
throw NotFoundException(__FILE__, __LINE__);
}
}
示例6: IllegalArgumentException
AsyncResult::AsyncResult(const CommunicatorPtr& communicator,
const IceInternal::InstancePtr& instance,
const string& op,
const CallbackBasePtr& del,
const LocalObjectPtr& cookie) :
_instance(instance),
_sentSynchronously(false),
_is(instance.get(), Ice::currentProtocolEncoding),
_communicator(communicator),
_operation(op),
_callback(del),
_cookie(cookie),
_state(0)
{
if(!_callback)
{
throw IceUtil::IllegalArgumentException(__FILE__, __LINE__);
}
const_cast<CallbackBasePtr&>(_callback) = _callback->verify(_cookie);
}
示例7: stream
void
SqlStringApplicationInfoDict::put(const DatabaseConnectionPtr& connection,
const string& name,
const ApplicationInfo& info)
{
IceInternal::InstancePtr instance = IceInternal::getInstance(_communicator);
IceInternal::BasicStream stream(instance.get());
stream.startWriteEncaps();
info.descriptor.__write(&stream);
stream.writePendingObjects();
stream.endWriteEncaps();
QSqlQuery query(connection->sqlConnection());
ostringstream queryString;
queryString << "UPDATE " << _table << " SET uuid = ?, createTime = '" << info.createTime
<< "', createUser = ?, updateTime = '" << info.updateTime << "', updateUser = ?, revision = '"
<< info.revision << "', descriptor = ";
QString driver = connection->sqlConnection().driverName();
if(driver == "QPSQL" || driver == "QODBC")
{
vector<Ice::Byte> bytes(stream.b.size());
::memcpy(&bytes[0], stream.b.begin(), stream.b.size());
if(driver == "QPSQL")
{
queryString << "E'" << escapePsqlBinary(bytes) << "'";
}
else
{
queryString << "0x" << escapeOdbcBinary(bytes);
}
}
else
{
queryString << "?";
}
queryString << " WHERE name = ?;";
query.prepare(queryString.str().c_str());
int placeholder = 0;
query.bindValue(placeholder++, info.uuid.c_str());
query.bindValue(placeholder++, info.createUser.c_str());
query.bindValue(placeholder++, info.updateUser.c_str());
if(driver != "QPSQL" && driver != "QODBC")
{
QByteArray bytes;
bytes.resize(static_cast<int>(stream.b.size()));
::memcpy(bytes.data(), stream.b.begin(), stream.b.size());
QVariant descriptor(bytes);
query.bindValue(placeholder++, descriptor);
}
query.bindValue(placeholder, name.c_str());
if(!query.exec())
{
throwDatabaseException(__FILE__, __LINE__, query.lastError());
}
if(query.numRowsAffected() == 0)
{
//
// We do a find since some databases (MySQL) return 0 for number of rows affected
// if row exists but data was not changed from previous values.
//
try
{
find(connection, name);
}
catch(const NotFoundException&)
{
QSqlQuery insertQuery(connection->sqlConnection());
queryString.str("");
queryString << "INSERT INTO " << _table << " VALUES(?, ?, '" << info.createTime << "', ?, '"
<< info.updateTime << "', ?, '" << info.revision << "', ";
if(driver == "QPSQL" || driver == "QODBC")
{
vector<Ice::Byte> bytes(stream.b.size());
::memcpy(&bytes[0], stream.b.begin(), stream.b.size());
if(driver == "QPSQL")
{
queryString << "E'" << escapePsqlBinary(bytes) << "'";
}
else
{
queryString << "0x" << escapeOdbcBinary(bytes);
}
}
else
{
queryString << "?";
}
queryString << ");";
insertQuery.prepare(queryString.str().c_str());
//.........这里部分代码省略.........