本文整理汇总了C++中IsInitialized函数的典型用法代码示例。如果您正苦于以下问题:C++ IsInitialized函数的具体用法?C++ IsInitialized怎么用?C++ IsInitialized使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsInitialized函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Connect
int CIpSocket::Connect( const t_string &x_sAddress, unsigned int x_uPort )
{
if ( !x_sAddress.length() )
return 0;
// Punt if not initialized
if ( !IsInitialized() )
return 0;
CIpAddress addr;
// Were we passed a URL?
if ( !x_uPort && addr.LookupUri( x_sAddress ) )
return Connect( addr );
// Lookup the host address
if ( addr.LookupHost( x_sAddress, x_uPort ) )
return Connect( addr );
return 0;
}
示例2: SetupRegion
logical pc_ADK_Field :: SetupRegion ( )
{
PropertyHandle *pfc = GetParentProperty();
PropertyHandle *my_class = pfc->GPH("class");
PropertyHandle *member;
logical coll_opt;
char *type;
char *propnames = NULL;
logical term = NO;
BEGINSEQ
if ( IsInitialized() ) LEAVESEQ
propnames = strdup(GPH("sys_ident")->GetString());
if ( !my_class->Get(FIRST_INSTANCE) ) ERROR
pc_ADK_Class structure(*my_class);
if ( member = structure.GetMember(propnames) )
coll_opt = pc0_SDB_Member(member).IsMultipleRef() ? YES : NO;
else
{
pc_ADK_Class all_class(GetObjectHandle(),PI_Read);
PropertyHandle phpropnames(propnames);
if ( all_class.Get(phpropnames) )
{
type = "DRT_Extent";
coll_opt = YES;
}
}
*GPH("auto_open") = YES;
SetupDataSource(propnames,type,coll_opt);
SetupTitle(propnames);
RECOVER
term = YES;
ENDSEQ
if ( propnames )
free(propnames);
return(term);
}
示例3: GetState
/*
** Runs given function in script file and stores the retruned number or string.
**
*/
int LuaScript::RunFunctionWithReturn(const char* funcName, double& numValue, std::wstring& strValue)
{
auto L = GetState();
int type = LUA_TNIL;
if (IsInitialized())
{
// Push our table onto the stack
lua_rawgeti(L, LUA_GLOBALSINDEX, m_Ref);
// Push the function onto the stack
lua_getfield(L, -1, funcName);
if (lua_pcall(L, 0, 1, 0))
{
LuaManager::ReportErrors(m_File);
lua_pop(L, 1);
}
else
{
type = lua_type(L, -1);
if (type == LUA_TNUMBER)
{
numValue = lua_tonumber(L, -1);
}
else if (type == LUA_TSTRING)
{
size_t strLen = 0;
const char* str = lua_tolstring(L, -1, &strLen);
strValue = m_Unicode ?
StringUtil::WidenUTF8(str, (int)strLen) : StringUtil::Widen(str, (int)strLen);
numValue = strtod(str, nullptr);
}
lua_pop(L, 2);
}
}
return type;
}
示例4: RegisterComponentCreator
// ---------------------------------------------------------------------------
// VComponentManager::RegisterComponentCreator [static]
// ---------------------------------------------------------------------------
// Install a component creator function. If a library based creator exists,
// the new one will overwrite it.
//
VError VComponentManager::RegisterComponentCreator(CType inType, CreateComponentProcPtr inProcPtr, Boolean inOverwritePrevious)
{
if (!IsInitialized()) return VE_COMP_UNITIALISED;
VError error = VE_OK;
sAccessingTypes->Lock();
sAccessingChecked->Lock();
// Make sure the proc isn't allready installed
sLONG index = sComponentTypes->FindPos(inType);
if (index > 0 && !inOverwritePrevious && sComponentProcs->GetNth(index) == inProcPtr)
{
error = VE_COMP_ALLREADY_REGISTRED;
}
if (error == VE_OK)
{
if (index > 0)
{
// Replace old one
sComponentProcs->SetNth(inProcPtr, index);
}
else
{
// Add new one at end of list
sComponentProcs->AddTail(inProcPtr);
sComponentTypes->AddTail(inType);
sComponentLibraries->AddTail(NULL);
// Reset checking for unavailable components
ResetComponentRequirements(inType, false);
}
}
sAccessingChecked->Unlock();
sAccessingTypes->Unlock();
return error;
}
示例5: NS_ABORT_IF_FALSE
nsresult
Omnijar::GetURIString(Type aType, nsACString& aResult)
{
NS_ABORT_IF_FALSE(IsInitialized(), "Omnijar not initialized");
aResult.Truncate();
// Return an empty string for APP in the unified case.
if ((aType == APP) && sIsUnified) {
return NS_OK;
}
nsAutoCString omniJarSpec;
if (sPath[aType]) {
nsresult rv = NS_GetURLSpecFromActualFile(sPath[aType], omniJarSpec);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
aResult = "jar:";
if (sIsNested[aType]) {
aResult += "jar:";
}
aResult += omniJarSpec;
aResult += "!";
if (sIsNested[aType]) {
aResult += "/" NS_STRINGIFY(OMNIJAR_NAME) "!";
}
} else {
nsCOMPtr<nsIFile> dir;
nsDirectoryService::gService->Get(SPROP(aType), NS_GET_IID(nsIFile),
getter_AddRefs(dir));
nsresult rv = NS_GetURLSpecFromActualFile(dir, aResult);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
aResult += "/";
return NS_OK;
}
示例6: Serialize
//! serializes the entity to/from a PropertyStream
void ParticleGenerator::Serialize(PropertyStream& stream)
{
super::Serialize(stream);
bool bMaxParticlesChanged = stream.Serialize(PT_UInt, "MaxParticles", &m_MaxParticles);
stream.Serialize(PT_Int, "ParticlesPerSecond", &m_ParticlesPerSecond);
stream.Serialize(PT_Range, "ParticleLife", &m_rParticleLife);
stream.Serialize(PT_Range, "ParticleSpeed", &m_rParticleInitialSpeed);
bool bParticleSizeChanged = stream.Serialize(PT_Float, "ParticleSize", &m_fParticleSize);
stream.Serialize(PT_Vec3, "Direction", &m_vDirection);
stream.Serialize(PT_Vec3, "Gravity", &m_vGravity);
stream.Serialize(PT_AABBox3D, "EmitBox", &m_EmitBox);
stream.Serialize(PT_AABBox3D, "BoundingBox", &m_BoundingBox);
stream.Serialize(PT_UInt, "PoolSize", &m_PoolSize);
if(stream.Serialize(PT_Float, "ActiveTime", &m_fActiveTime))
{
m_bActive = true;
}
stream.Serialize(PT_Bool, "Explosive", &m_bExplosive);
bool bApplyWorldTransformChanged = stream.Serialize(PT_Bool, "ApplyWorldTransform", &m_bApplyWorldTransform);
if(IsInitialized())
{
VertexBuffer* pVertexBuffer = GetComponent<GraphicComponent>()->GetVertexBuffer();
bool bPointSprite = GraphicExtensionHandler::Instance()->HasExtension(GraphicExtensionHandler::E_PointSprite);
if(bMaxParticlesChanged)
{
u32 numVertices = bPointSprite ? m_MaxParticles : m_MaxParticles*6;
pVertexBuffer->SetVertices(snew Vertex3D[numVertices], numVertices);
}
if(bParticleSizeChanged && bPointSprite)
{
static_cast<PointSpriteStateSetter*>(pVertexBuffer->GetRenderStateSetter())->SetPointSize(m_fParticleSize);
}
if(bApplyWorldTransformChanged)
{
pVertexBuffer->SetApplyWorldTransforms(m_bApplyWorldTransform);
}
}
}
示例7: AfxMessageBox
TextVisitor::TextVisitor(LPCTSTR fileName)
{
m_topLevel = 0;
m_lastNoteNr = 0;
m_initOk = TRUE;
m_buffer = NULL;
m_connents = "";
if(!m_outFile.Open(fileName, CFile::modeCreate | CFile::modeWrite)){
m_initOk = FALSE;
AfxMessageBox(IDS_OPEN_ERR);
}
if(IsInitialized()){
for(int i = 0; i < 40; i++){
m_separator += _T("-");
}
m_separator += NL;
CString title;
AfxGetApp()->m_pMainWnd->GetWindowText(title);
WriteTextLn(title + _T(" generated on ") + XMLDoc::GetTimeString());
WriteTextLn(CString(_T("")));
}
}
示例8: TermLevel
// ----------------------------------------------------------------------- //
//
// ROUTINE: CMusic::TermMusicLevel
//
// PURPOSE: Terminate Music for Current Game Level
//
// ----------------------------------------------------------------------- //
void CMusic::TermLevel()
{
// make sure mgrs are initialized
if (!IsInitialized()) return;
if (m_pMusicMgr == NULL) return;
// make sure directmusic mgr was available
if (m_pMusicMgr != NULL)
{
// initialize the music mgr
m_pMusicMgr->TermLevel();
}
{ // BL 09/26/00
// clear the state
m_State.Clear();
}
// set level initialized flag
m_bLevelInitialized = FALSE;
}
示例9: RemoveAudioChannelLayout
//_____________________________________________________________________________
//
OSStatus AUPannerBase::SetAudioChannelLayout( AudioUnitScope inScope,
AudioUnitElement inElement,
const AudioChannelLayout * inLayout)
{
if (!inLayout)
return RemoveAudioChannelLayout(inScope, inElement);
if (!ChannelLayoutTagIsSupported(inScope, inElement, inLayout->mChannelLayoutTag))
return kAudioUnitErr_FormatNotSupported;
CAAudioChannelLayout* caacl = NULL;
UInt32 currentChannels;
switch (inScope)
{
case kAudioUnitScope_Input:
caacl = &mInputLayout;
currentChannels = GetNumberOfInputChannels();
break;
case kAudioUnitScope_Output:
caacl = &mOutputLayout;
currentChannels = GetNumberOfOutputChannels();
break;
default:
return kAudioUnitErr_InvalidScope;
}
if (inElement != 0)
return kAudioUnitErr_InvalidElement;
UInt32 numChannelsInLayout = CAAudioChannelLayout::NumberChannels(*inLayout);
if (currentChannels != numChannelsInLayout)
return kAudioUnitErr_InvalidPropertyValue;
*caacl = inLayout;
if (IsInitialized())
UpdateBypassMatrix();
return noErr;
}
示例10: Listen
int CIpSocket::Listen( unsigned int x_uMaxConnections )
{
// Punt if not initialized
if ( !IsInitialized() )
return 0;
// Must have socket
if ( !IsSocket() )
{ m_uConnectState |= eCsError;
return 0;
} // end if
// Valid number of connections?
if ( x_uMaxConnections == 0 )
x_uMaxConnections = 16;
// x_uMaxConnections = SOMAXCONN;
// Start the socket listening
int nRet = listen( (SOCKET)m_hSocket, (int)( x_uMaxConnections ? x_uMaxConnections : SOMAXCONN ) );
// Save the last error code
m_uLastError = WSAGetLastError();
if ( WSAEWOULDBLOCK == m_uLastError )
m_uLastError = 0, nRet = 0;
// Error?
if ( c_SocketError == (t_SOCKET)nRet )
{ m_uConnectState |= eCsError;
return 0;
} // end if
// We're trying to connect
m_lActivity++;
m_uConnectState |= eCsConnecting;
// Return the result
return 1;
}
示例11: UnRegisterComponentCreator
// ---------------------------------------------------------------------------
// VComponentManager::UnRegisterComponentCreator [static]
// ---------------------------------------------------------------------------
// Remove a component creator function. If a library based creator exists,
// it will become the defaut one.
//
VError VComponentManager::UnRegisterComponentCreator(CType inType, CreateComponentProcPtr inProcPtr)
{
if (!IsInitialized()) return VE_COMP_UNITIALISED;
VError error = VE_COMP_LIBRARY_NOT_FOUND;
sAccessingTypes->Lock();
sAccessingChecked->Lock();
// Make sure the proc is installed
sLONG index = sComponentTypes->FindPos(inType);
if (index > 0 && sComponentProcs->GetNth(index) == inProcPtr)
{
VLibrary* library = sComponentLibraries->GetNth(index);
if (library == NULL)
{
sComponentLibraries->DeleteNth(index);
sComponentProcs->DeleteNth(index);
sComponentTypes->DeleteNth(index);
// Reset checking for available components
ResetComponentRequirements(inType, true);
}
else
{
library->Release();
sComponentProcs->SetNth(NULL, index);
}
error = VE_OK;
}
sAccessingChecked->Unlock();
sAccessingTypes->Unlock();
return error;
}
示例12: Init
// ----------------------------------------------------------------------- //
//
// ROUTINE: CMusic::Init
//
// PURPOSE: Initialize the music
//
// ----------------------------------------------------------------------- //
LTBOOL CMusic::Init( ILTClient *pClientDE)
{
// make sure we are not already initialized
if (IsInitialized()) return LTTRUE;
m_pClientDE = pClientDE;
m_bMusicEnabled = TRUE;
m_bLevelInitialized = FALSE;
m_pMusicMgr = NULL;
// get the musicenable console var
HCONSOLEVAR hVar = g_pLTClient->GetConsoleVar("disablemusic");
if (hVar)
{
// check if music is disabled
if (((int)g_pLTClient->GetVarValueFloat(hVar)) != 0)
{
m_bMusicEnabled = FALSE;
}
}
// if music is enabled
if (MusicEnabled())
{
// get a pointer to the music mgr
m_pMusicMgr = g_pLTClient->GetDirectMusicMgr();
// make sure directmusic mgr was available
if (m_pMusicMgr != NULL)
{
// initialize the music mgr
m_pMusicMgr->Init();
}
}
return LTTRUE;
}
示例13: switch
void SerialPortC::SetSpeed(PortSpeedE NewSpeed)
{
Speed = NewSpeed;
int rs_Baud;
switch (NewSpeed)
{
default: assert(FALSE);
case PS_300: { rs_Baud = 2; break; }
case PS_600: { rs_Baud = 3; break; }
case PS_1200: { rs_Baud = 4; break; }
case PS_2400: { rs_Baud = 5; break; }
case PS_4800: { rs_Baud = 6; break; }
case PS_9600: { rs_Baud = 7; break; }
case PS_19200: { rs_Baud = 8; break; }
case PS_38400: { rs_Baud = 9; break; }
case PS_57600: { rs_Baud = 10; break; }
case PS_115200: { rs_Baud = 11; break; }
}
// disable interrupts for baud change
if (IsInitialized())
{
Deinit();
}
assert(initrs);
(*initrs)((cfg.mdata - 1), rs_Baud, 0, 0, 3, cfg.checkCTS);
SetInitialized();
if (cfg.baudPause)
{
pause(cfg.baudPause);
}
}
示例14: Flush
OMX_ERRORTYPE COMXCoreTunel::Flush()
{
if(!m_DllOMXOpen || !m_src_component || !m_dst_component || !m_tunnel_set || !IsInitialized())
return OMX_ErrorUndefined;
Lock();
OMX_ERRORTYPE omx_err = OMX_ErrorNone;
if(m_src_component->GetComponent())
{
omx_err = m_src_component->SendCommand(OMX_CommandFlush, m_src_port, NULL);
if(omx_err != OMX_ErrorNone && omx_err != OMX_ErrorSameState)
{
CLog::Log(LOGERROR, "COMXCoreTunel::Flush - Error flush port %d on component %s omx_err(0x%08x)",
m_src_port, m_src_component->GetName().c_str(), (int)omx_err);
}
}
if(m_dst_component->GetComponent())
{
omx_err = m_dst_component->SendCommand(OMX_CommandFlush, m_dst_port, NULL);
if(omx_err != OMX_ErrorNone && omx_err != OMX_ErrorSameState)
{
CLog::Log(LOGERROR, "COMXCoreTunel::Flush - Error flush port %d on component %s omx_err(0x%08x)",
m_dst_port, m_dst_component->GetName().c_str(), (int)omx_err);
}
}
if(m_src_component->GetComponent())
omx_err = m_src_component->WaitForCommand(OMX_CommandFlush, m_src_port);
if(m_dst_component->GetComponent())
omx_err = m_dst_component->WaitForCommand(OMX_CommandFlush, m_dst_port);
UnLock();
return OMX_ErrorNone;
}
示例15: event_level
Eluna::Eluna() :
event_level(0),
push_counter(0),
enabled(false),
L(NULL),
eventMgr(NULL),
ServerEventBindings(NULL),
PlayerEventBindings(NULL),
GuildEventBindings(NULL),
GroupEventBindings(NULL),
VehicleEventBindings(NULL),
BGEventBindings(NULL),
PacketEventBindings(NULL),
CreatureEventBindings(NULL),
CreatureGossipBindings(NULL),
GameObjectEventBindings(NULL),
GameObjectGossipBindings(NULL),
ItemEventBindings(NULL),
ItemGossipBindings(NULL),
PlayerGossipBindings(NULL),
MapEventBindings(NULL),
InstanceEventBindings(NULL),
CreatureUniqueBindings(NULL)
{
ASSERT(IsInitialized());
OpenLua();
// Replace this with map insert if making multithread version
// Set event manager. Must be after setting sEluna
// on multithread have a map of state pointers and here insert this pointer to the map and then save a pointer of that pointer to the EventMgr
eventMgr = new EventMgr(&Eluna::GEluna);
}