コード例 #1
0
ファイル: sockets.cpp プロジェクト: AmberSandDan/htmapp
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
0
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
0
ファイル: LuaScript.cpp プロジェクト: jithuin/infogeezer
/*
** 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
0
// ---------------------------------------------------------------------------
// 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
0
ファイル: Omnijar.cpp プロジェクト: Andrel322/gecko-dev
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
0
	//! 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
0
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
0
// ----------------------------------------------------------------------- //
//
//	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
0
ファイル: Omnijar.cpp プロジェクト: Andrel322/gecko-dev
already_AddRefed<nsZipArchive>
Omnijar::GetReader(nsIFile* aPath)
{
  NS_ABORT_IF_FALSE(IsInitialized(), "Omnijar not initialized");

  bool equals;
  nsresult rv;

  if (sPath[GRE] && !sIsNested[GRE]) {
    rv = sPath[GRE]->Equals(aPath, &equals);
    if (NS_SUCCEEDED(rv) && equals) {
      return GetReader(GRE);
    }
  }
  if (sPath[APP] && !sIsNested[APP]) {
    rv = sPath[APP]->Equals(aPath, &equals);
    if (NS_SUCCEEDED(rv) && equals) {
      return GetReader(APP);
    }
  }
  return nullptr;
}
コード例 #10
0
//_____________________________________________________________________________
//
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;
}
コード例 #11
0
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;
}
コード例 #12
0
// ---------------------------------------------------------------------------
// 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;
}
コード例 #13
0
// ----------------------------------------------------------------------- //
//
//	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;
}
コード例 #14
0
ファイル: port.cpp プロジェクト: dylancarlson/citplus
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);
		}
	}
コード例 #15
0
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;
}
コード例 #16
0
ファイル: LuaEngine.cpp プロジェクト: AlexShiLucky/Eluna
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);
}
コード例 #17
0
int LMEConnection::ChannelData(UINT32 recipientChannel,
			       UINT32 len, unsigned char *buffer)
{
	if (!IsInitialized()) {
		PRINT("State: not connected to HECI.\n");
		return false;
	}

	APF_CHANNEL_DATA_MESSAGE *message;

	if (len > _heci.GetBufferSize() - sizeof(APF_CHANNEL_DATA_MESSAGE)) {
		return -1;
	}

	message = (APF_CHANNEL_DATA_MESSAGE *)_txBuffer;
	message->MessageType = APF_CHANNEL_DATA;
	message->RecipientChannel = htonl(recipientChannel);
	message->DataLength = htonl(len);
	memcpy(message->Data, buffer, len);

	PRINT("Sending %d bytes to recipient channel %d.\n", len, recipientChannel);
	return _sendMessage((unsigned char *)message, sizeof(APF_CHANNEL_DATA_MESSAGE) + len);
}
コード例 #18
0
ファイル: OpHashTable.cpp プロジェクト: prestocore/browser
OP_STATUS OpHashTable::Remove(const void* key, void** data)
{
	OP_ASSERT(data != NULL);
	*data = NULL;

	if (!IsInitialized())
	{
		return OpStatus::ERR;
	}

	if (nr_of_elements <= minimumNrOfElements[hash_size_index] && hash_size_index > 0 && minimumNrOfElements[hash_size_index - 1] >= minimum_nr_of_elements)
	{
		OP_STATUS ret_val = Rehash(hash_size_index - 1);
		if (OpStatus::IsSuccess(ret_val))
		{
				hash_size_index--;
		}
	}

	RETURN_IF_ERROR(hash_backend.Remove(key, data)); // Never returns ERR_NO_MEMORY.
	nr_of_elements--;
	return OpStatus::OK;
}
コード例 #19
0
CComponent* VComponentManager::RetainComponent(CRef inRef)
{
	if (!IsInitialized()) return NULL;
	
	CComponent*	component = NULL;
	VArrayIteratorOf<CComponent*>	iterator(*sComponentInstances);
	
	sAccessingInstances->Lock();
	
	// Iterate through instances
	while ((component = iterator.Next()) != NULL)
	{
		if (component->GetComponentRef() == inRef)
		{
			component->Retain();
			break;
		}
	}
	
	sAccessingInstances->Unlock();
	
	return component;
}
コード例 #20
0
ファイル: QTTrack.cpp プロジェクト: 248668342/ffmpeg-windows
// -------------------------------------
// Initialization functions
//
QTTrack::ErrorCode QTTrack::Initialize(void)
{
    // Temporary vars
    QTFile::AtomTOCEntry    *tempTOCEntry;


    //
    // Don't initialize more than once.
    if( IsInitialized() )
        return errNoError;

    //
    // Make sure that we were able to read in our track header atom.
    if( fTrackHeaderAtom == NULL )
        return errInvalidQuickTimeFile;

    //
    // See if this track has a name and load it in.
    if( fFile->FindTOCEntry(":udta:name", &tempTOCEntry, &fTOCEntry) ) {
        fTrackName = NEW char[ (SInt32) (tempTOCEntry->AtomDataLength + 1) ];
        if( fTrackName != NULL )
            fFile->Read(tempTOCEntry->AtomDataPos, fTrackName, (UInt32) tempTOCEntry->AtomDataLength);
    }
コード例 #21
0
/*! @method SetProperty */
OSStatus			AUPannerBase::SetProperty(AudioUnitPropertyID 		inID,
										AudioUnitScope 				inScope,
										AudioUnitElement 			inElement,
										const void *				inData,
										UInt32 						inDataSize)
{
	switch (inID) 
	{
		case kAudioUnitProperty_BypassEffect:
				if (inDataSize < sizeof(UInt32))
					return kAudioUnitErr_InvalidPropertyValue;
				bool tempNewSetting = *((UInt32*)inData) != 0;
					// we're changing the state of bypass
				if (tempNewSetting != IsBypassEffect()) 
				{
					if (!tempNewSetting && IsBypassEffect() && IsInitialized()) // turning bypass off and we're initialized
						Reset(0, 0);
					SetBypassEffect (tempNewSetting);
				}
				return noErr;
	}
    return AUBase::SetProperty(inID, inScope, inElement, inData, inDataSize);
}
コード例 #22
0
ファイル: WinSocket.cpp プロジェクト: aminsyed/rulib
BOOL CWinSocket::Create( int af, int type, int protocol )
{_STT();

	// Punt if not initialized
	if ( !IsInitialized() ) { TRACE( "CWinSocket: Error - Call InitSockets()" ); return FALSE; }

	// Close any open socket
	Destroy();

	// Create a scocket
	m_hSocket = socket( af, type, protocol );
	
	// Save the last error code
	m_uLastError = WSAGetLastError();

	// Create the event handle
	CreateEventHandle();

	// Capture all events
	EventSelect();

	return IsSocket();
}
コード例 #23
0
int Ifpack2_SparseContainer<T>::Compute(const Tpetra_RowMatrix& Matrix_in)
{

    IsComputed_ = false;
    if (!IsInitialized()) {
        IFPACK2_CHK_ERR(Initialize());
    }

    // extract the submatrices
    IFPACK2_CHK_ERR(Extract(Matrix_in));

    // initialize the inverse operator
    IFPACK2_CHK_ERR(Inverse_->Initialize());

    // compute the inverse operator
    IFPACK2_CHK_ERR(Inverse_->Compute());

    Label_ = "Ifpack2_SparseContainer";

    IsComputed_ = true;

    return(0);
}
コード例 #24
0
	//! serializes the entity to/from a PropertyStream
	void ParticleGenerator2D::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_Vec2, "Direction", &m_vDirection);
		stream.Serialize(PT_Vec2, "Gravity", &m_vGravity);
		stream.Serialize(PT_UInt, "PoolSize", &m_PoolSize);
		bool bApplyWorldTransformChanged = stream.Serialize(PT_Bool, "ApplyWorldTransform", &m_bApplyWorldTransform);
		
		if(stream.Serialize(PT_Float, "ActiveTime", &m_fActiveTime))
		{
			m_bActive = true;
		}
		stream.Serialize(PT_Bool, "Explosive", &m_bExplosive);		
		
		if(IsInitialized())
		{
			VertexBuffer* pVertexBuffer = GetComponent<GraphicComponent>()->GetVertexBuffer();
			if(bMaxParticlesChanged)
			{
				pVertexBuffer->SetVertices(snew Vertex3D[m_MaxParticles], m_MaxParticles);
			}
			if(bParticleSizeChanged)
			{
				static_cast<PointSpriteStateSetter*>(pVertexBuffer->GetRenderStateSetter())->SetPointSize(m_fParticleSize);
			}
			if(bApplyWorldTransformChanged)
			{
				pVertexBuffer->SetApplyWorldTransforms(m_bApplyWorldTransform);
			}
		}
	}	
コード例 #25
0
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	CMusic::Play
//
//	PURPOSE:	Begin playing music
//
// ----------------------------------------------------------------------- //
// Begin playing music
void CMusic::Play(int32 nIntensity /* = -1 */, int32 nStart /* = LTDMEnactDefault */)
{
	// make sure mgrs are initialized
	if (!IsInitialized()) return;
	if (!IsLevelInitialized()) return;
	if (m_pMusicMgr == NULL) return;

	if ( !m_bPlaying )
	{
		m_pMusicMgr->Play();
	}

	m_State.bPlaying = LTTRUE;
	m_bPlaying = LTTRUE;

	if ( nIntensity == -1 )
	{
		m_pMusicMgr->ChangeIntensity(m_State.nIntensity, m_State.nIntensityEnact);
	}
	else
	{
		m_pMusicMgr->ChangeIntensity(nIntensity, (LTDMEnactTypes)nStart);
	}
}
コード例 #26
0
ファイル: Actor.cpp プロジェクト: innovatelogic/ilogic-vm
//----------------------------------------------------------------------------------------------
bool CActor::IsNeedCollect()
{
	if (!IsInitialized() || !bMarkerDeleteFlag){ // do not check not fully initialized objects
		return false;
	}

	if (IsPendingToDelete()) // need to be deleted
	{
		return true;
	}
	else
	{
		TVecActorChildIterator IterActor = m_ChildNodes.begin();
		while (IterActor != m_ChildNodes.end())
		{
			if ((*IterActor)->IsNeedCollect()) // found pending to delete child object
			{
				return true;			
			}
			++IterActor;
		}
	}
	return false;
}
コード例 #27
0
int Ifpack2_SparseContainer<T>::
SetMatrixElement(const int row, const int col, const double value)
{
    if (!IsInitialized())
        IFPACK2_CHK_ERR(-3); // problem not shaped yet

    if ((row < 0) || (row >= NumRows())) {
        IFPACK2_CHK_ERR(-2); // not in range
    }

    if ((col < 0) || (col >= NumRows())) {
        IFPACK2_CHK_ERR(-2); // not in range
    }

    int ierr = Matrix_->InsertGlobalValues((int)row,1,(double*)&value,(int*)&col);
    if (ierr < 0) {
        ierr = Matrix_->SumIntoGlobalValues((int)row,1,(double*)&value,(int*)&col);
        if (ierr < 0)
            IFPACK2_CHK_ERR(-1);
    }

    return(0);

}
コード例 #28
0
ファイル: WinSocket.cpp プロジェクト: aminsyed/rulib
BOOL CWinSocket::Bind(UINT uPort)
{_STT();

	// Punt if not initialized
	if ( !IsInitialized() ) { TRACE( "CWinSocket: Error - Call InitSockets()" ); return FALSE; }

	// Create socket if there is none
	if ( !IsSocket() && !Create() ) 
	{	Destroy(); return FALSE; }

	sockaddr_in sai;
	ZeroMemory( &sai, sizeof( sai ) );

	sai.sin_family = PF_INET;
	sai.sin_port = htons( (WORD)uPort );

	// Attempt to bind the socket
	int nRet = bind( m_hSocket, (sockaddr*)&sai, sizeof( sockaddr_in ) );

	// Save the last error code
	m_uLastError = WSAGetLastError();

	return !nRet;
}
コード例 #29
0
int CIpSocket::Bind( unsigned int x_uPort )
{
	// Punt if not initialized
	if ( !IsInitialized() )
		return 0;

	// Create socket if there is none
	if ( !IsSocket() && !Create() )
	{	Destroy();
		m_uConnectState |= eCsError;
		return 0;
	} // end if

	sockaddr_in sai;
	ZeroMemory( &sai, sizeof( sai ) );
	sai.sin_family = PF_INET;
	sai.sin_port = htons( (WORD)x_uPort );

	// Attempt to bind the socket
	int nRet = bind( (SOCKET)m_hSocket, (sockaddr*)&sai, sizeof( sockaddr_in ) );

	// Save the last error code
	m_uLastError = WSAGetLastError();
	if ( WSAEWOULDBLOCK == m_uLastError )
		m_uLastError = 0, nRet = 0;

	// Grab the address
	CIpSocket_GetAddressInfo( &m_addrLocal, &sai );

	if ( nRet )
	{	m_uConnectState |= eCsError;
		return 0;
	} // end if

	return 1;
}
コード例 #30
0
LTBOOL CMusic::RestoreMusicState(const CMusicState & newState)
{
    if (!IsInitialized()) return LTFALSE;

	// See if the new state is valid...

	if (!strlen(newState.szDirectory) || !strlen(newState.szControlFile))
	{
		return LTFALSE;
	}

	// See if anything has changed...

	if ((stricmp(m_State.szDirectory, newState.szDirectory) != 0) ||
		(stricmp(m_State.szControlFile, newState.szControlFile) != 0))
	{
		if (!InitLevel((char*)newState.szDirectory, (char*)newState.szControlFile))
		{
            return LTFALSE;
		}
	}

    return LTTRUE;
}