本文整理汇总了C++中CContext类的典型用法代码示例。如果您正苦于以下问题:C++ CContext类的具体用法?C++ CContext怎么用?C++ CContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
CStratege* stratege = new CStrategeB();
CContext* context = new CContext(stratege);
context->operation();
return 0;
}
示例2: ASSERT
bool CConfigParser::ParseContexts(DOMNodeList* contextNodes, ADeviceListener& configClass)
{
ASSERT(contextNodes->getLength() == 1);
DOMNode* contextNode = contextNodes->item(0);
DOMNodeList* contexts = contextNode->getChildNodes();
for(unsigned long idx = 0; idx < contexts->getLength(); idx++)
{
DOMNode* currentContext = contexts->item(idx);
wstring contextNodeName = currentContext->getNodeName();
if(contextNodeName.compare(L"#text") == 0)
continue;
wstring contextName = currentContext->getAttributes()->getNamedItem(L"name")->getNodeValue();
CContext* contextToAdd = new CContext();
unsigned long attrLen = currentContext->getAttributes()->getLength();
for(unsigned long attr = 0; attr < attrLen; attr++)
{
DOMNode* deviceContextAttr = currentContext->getAttributes()->item(attr);
if(wcscmp(deviceContextAttr->getNodeName(), L"deviceContext") == 0)
{
wstring deviceContextName = deviceContextAttr->getNodeValue();
CDeviceContext* deviceContext = configClass.GetDeviceContexts()[deviceContextName];
IDeviceCapture* device = configClass.GetDevices()[deviceContext->GetDeviceName()];
contextToAdd->AddDeviceContext(device, deviceContext);
}
}
configClass.AddContext(contextName, contextToAdd);
}
return true;
}
示例3: cxios_solve_inheritance
void cxios_solve_inheritance()
{
CTimer::get("XIOS").resume();
CContext* context = CContext::getCurrent();
context->solveAllInheritance(false);
CTimer::get("XIOS").suspend();
}
示例4: cxios_set_variable_data_char
void cxios_set_variable_data_char(const char* varId, int varIdSize, const char* data, int dataSizeIn, bool* isVarExisted)
{
std::string varIdStr, dataStr;
if (!cstr2string(varId, varIdSize, varIdStr)) return;
if (!cstr2string(data, dataSizeIn, dataStr))
{
*isVarExisted = false;
return;
}
CTimer::get("XIOS").resume();
CTimer::get("XIOS set variable data").resume();
CContext* context = CContext::getCurrent();
*isVarExisted = CVariable::has(context->getId(), varIdStr);
if (*isVarExisted)
{
CVariable::get(context->getId(), varIdStr)->setData<string>(dataStr);
//CVariable::get(context->getId(), varIdStr)->sendValue();
}
CTimer::get("XIOS set variable data").suspend();
CTimer::get("XIOS").suspend();
}
示例5: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
CContext context;
CConcreteStrategyA *pconcreteA = new CConcreteStrategyA();
ClientToUseContext( &context );
context.SetStrategyObj( pconcreteA );
ClientToUseContext( &context );
CConcreteStrategyB *pconcreteB = new CConcreteStrategyB();
context.SetStrategyObj( pconcreteB );
ClientToUseContext( &context );
CConcreteDefault *pconcrete_default = new CConcreteDefault();
context.SetStrategyObj( pconcrete_default );
ClientToUseContext( &context );
context.SetStrategyObj( nullptr );
ClientToUseContext( &context );
delete pconcreteA;
delete pconcreteB;
delete pconcrete_default;
return 0;
}
示例6:
void CHmac32::SetKey(const Byte *key, size_t keySize)
{
UInt32 keyTemp[kBlockSizeInWords];
size_t i;
for (i = 0; i < kBlockSizeInWords; i++)
keyTemp[i] = 0;
if(keySize > kBlockSize)
{
CContext sha;
sha.Init();
sha.Update(key, keySize);
Byte digest[kDigestSize];
sha.Final(digest);
for (int i = 0 ; i < kDigestSizeInWords; i++)
keyTemp[i] =
((UInt32)(digest[i * 4 + 0]) << 24) |
((UInt32)(digest[i * 4 + 1]) << 16) |
((UInt32)(digest[i * 4 + 2]) << 8) |
((UInt32)(digest[i * 4 + 3]));
keySize = kDigestSizeInWords;
}
else
for (size_t i = 0; i < keySize; i++)
keyTemp[i / 4] |= (key[i] << (24 - 8 * (i & 3)));
for (i = 0; i < kBlockSizeInWords; i++)
keyTemp[i] ^= 0x36363636;
_sha.Init();
_sha.Update(keyTemp, kBlockSizeInWords);
for (i = 0; i < kBlockSizeInWords; i++)
keyTemp[i] ^= 0x36363636 ^ 0x5C5C5C5C;
_sha2.Init();
_sha2.Update(keyTemp, kBlockSizeInWords);
}
示例7: cxios_context_close_definition
void cxios_context_close_definition()
{
CTimer::get("XIOS").resume();
CTimer::get("XIOS close definition").resume();
CContext* context = CContext::getCurrent();
context->closeDefinition();
CTimer::get("XIOS close definition").suspend();
CTimer::get("XIOS").suspend();
}
示例8: cxios_context_finalize
void cxios_context_finalize()
{
CTimer::get("XIOS").resume();
CTimer::get("XIOS context finalize").resume();
CContext* context = CContext::getCurrent();
context->finalize();
CTimer::get("XIOS context finalize").suspend();
CTimer::get("XIOS").suspend();
}
示例9: cxios_context_is_initialized
void cxios_context_is_initialized(const char* context_id , int len_context_id, bool* initialized)
{
std::string str;
if (!cstr2string(context_id, len_context_id, str)) return;
CTimer::get("XIOS").resume();
CContext* context = CContext::get(str, str);
*initialized=context->isInitialized();
CTimer::get("XIOS").suspend();
}
示例10: PaintHandles
void CDrawLine::PaintHandles( CContext &dc )
{
dc.SelectBrush(cBLACK);
dc.SelectPen(PS_SOLID,0,cBLACK);
CDRect r1(m_point_a.x-2,m_point_a.y-2,m_point_a.x+2,m_point_a.y+2);
CDRect r2(m_point_b.x-2,m_point_b.y-2,m_point_b.x+2,m_point_b.y+2);
dc.Rectangle(r1);
dc.Rectangle(r2);
}
示例11: create
void* create(IConfig* config, IFactory* factory)
{
CContext* context = new CContext(config, factory);
if (!context->create())
{
delete context;
context = NULL;
}
return context;
}
示例12: cxios_write_data_k80
void cxios_write_data_k80(const char* fieldid, int fieldid_size, double* data_k8, int data_Xsize)
{
std::string fieldid_str;
if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return;
CTimer::get("XIOS").resume();
CTimer::get("XIOS send field").resume();
CContext* context = CContext::getCurrent();
if (!context->hasServer && !context->client->isAttachedModeEnabled())
context->checkBuffersAndListen();
CArray<double, 1> data(data_k8, shape(data_Xsize), neverDeleteData);
CField::get(fieldid_str)->setData(data);
CTimer::get("XIOS send field").suspend();
CTimer::get("XIOS").suspend();
}
示例13: PaintHandles
void CDrawRectOutline::PaintHandles( CContext &dc )
{
// Put some handles around this object
CDRect r(m_point_a.x,m_point_a.y,m_point_b.x,m_point_b.y);
dc.PaintTracker( r );
}
示例14: Paint
void CDrawBlockRotate::Paint(CContext &dc, paint_options options)
{
// Draw marquee
dc.SelectBrush();
if (m_point_a.x < m_point_b.x)
{
dc.SelectPen(PS_MARQUEE, 1, cBLOCK);
}
else
{
// Other marquee pen for right to left selection
dc.SelectPen(PS_MARQUEE2, 1, cBLOCK);
}
dc.SetROP2(R2_COPYPEN);
dc.Rectangle(theArea);
}
示例15: cxios_get_variable_data_logic
void cxios_get_variable_data_logic(const char* varId, int varIdSize, bool* data, bool* isVarExisted)
{
std::string varIdStr;
if (!cstr2string(varId, varIdSize, varIdStr)) return;
CTimer::get("XIOS").resume();
CTimer::get("XIOS get variable data").resume();
CContext* context = CContext::getCurrent();
*isVarExisted = CVariable::has(context->getId(), varIdStr);
if (*isVarExisted)
{
*data = CVariable::get(context->getId(), varIdStr)->getData<bool>();
}
CTimer::get("XIOS get variable data").suspend();
CTimer::get("XIOS").suspend();
}