My Project
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
NPL::CNeuronFileState Class Reference

each neuron file that is activated will have a CNeuronFileState structure kept. More...

#include <NeuronFileState.h>

Public Member Functions

 CNeuronFileState (const std::string &filename)
 
bool IsProcessing () const
 whether the message is still being processed in the activation function. More...
 
void SetProcessing (bool val)
 
bool PushMessage (NPLMessage_ptr &msg)
 
bool PopMessage (NPLMessage_ptr &msg)
 Pop a message. More...
 
bool GetMessage (NPLMessage_ptr &msg)
 get the message without removing it from the stack
 
bool IsEmpty ()
 if message queue is empty. More...
 
void ClearMessage ()
 clear all messages
 
bool PopClearState ()
 
void Tick (int nFrameMoveId)
 increase internal tick counter for activation. More...
 
int GetTick (int nFrameMoveId)
 get tick count for current frame. More...
 
int32 GetMaxQueueSize () const
 max number of messages in the pending message queue. More...
 
void SetMaxQueueSize (int32 val)
 
const std::string & GetFilename () const
 neuron file name
 
bool IsPreemptive ()
 Preemptive multi-tasking is simulated by counting instructions. More...
 
int32 GetPreemptiveInstructionCount () const
 if not 0, we will use coroutine and debug hook to simulate preemptive scheduling in user mode. More...
 
void SetPreemptiveInstructionCount (int32 val)
 

Protected Member Functions

void ClearMessageImp ()
 

Protected Attributes

int32 m_nActivationThisTick
 total number of activation calls in this/last tick. More...
 
int32 m_nFrameMoveId
 different for each tick
 
int32 m_nTotalActivations
 total number of activations since program starts. More...
 
int32 m_nPreemptiveInstructionCount
 if not 0, we will use coroutine and debug hook to simulate preemptive scheduling in user mode. More...
 
DWORD m_nActionState
 action state
 
bool m_isProcessing
 whether the message is still being processed in the activation function. More...
 
int32 m_nMaxQueueSize
 max number of messages in the pending message queue. More...
 
std::deque< NPLMessage_ptr > m_queue
 the pending message queue
 
std::string m_filename
 neuron file name
 

Friends

class CNPLRuntimeState
 

Detailed Description

each neuron file that is activated will have a CNeuronFileState structure kept.

This class is only used by the local NPL thread, so no lock is needed.

Member Function Documentation

§ GetMaxQueueSize()

int32 NPL::CNeuronFileState::GetMaxQueueSize ( ) const

max number of messages in the pending message queue.

Any new incoming messages will be dropped. By default its size is same as parent NPL thread's message queue size

§ GetPreemptiveInstructionCount()

int32 NPL::CNeuronFileState::GetPreemptiveInstructionCount ( ) const

if not 0, we will use coroutine and debug hook to simulate preemptive scheduling in user mode.

§ GetTick()

int NPL::CNeuronFileState::GetTick ( int  nFrameMoveId)

get tick count for current frame.

Parameters
nFrameMoveIdparent NPL thread's frame move id

§ IsEmpty()

bool NPL::CNeuronFileState::IsEmpty ( )

if message queue is empty.

§ IsPreemptive()

bool NPL::CNeuronFileState::IsPreemptive ( )

Preemptive multi-tasking is simulated by counting instructions.

§ IsProcessing()

bool NPL::CNeuronFileState::IsProcessing ( ) const

whether the message is still being processed in the activation function.

some activation will set this flag to true in case their processing is cross multiple NPL time slice (tick).

§ PopMessage()

bool NPL::CNeuronFileState::PopMessage ( NPLMessage_ptr &  msg)

Pop a message.

Returns
true if succeed or false if queue is empty.

§ PushMessage()

bool NPL::CNeuronFileState::PushMessage ( NPLMessage_ptr &  msg)
Returns
true if succeed, or false if queue is full.

§ Tick()

void NPL::CNeuronFileState::Tick ( int  nFrameMoveId)

increase internal tick counter for activation.

Parameters
nFrameMoveIdparent NPL thread's frame move id

Member Data Documentation

§ m_isProcessing

bool NPL::CNeuronFileState::m_isProcessing
protected

whether the message is still being processed in the activation function.

some activation will set this flag to true in case their processing is cross multiple NPL time slice (tick).

§ m_nActivationThisTick

int32 NPL::CNeuronFileState::m_nActivationThisTick
protected

total number of activation calls in this/last tick.

§ m_nMaxQueueSize

int32 NPL::CNeuronFileState::m_nMaxQueueSize
protected

max number of messages in the pending message queue.

Any new incoming messages will be dropped. By default its size is same as parent NPL thread's message queue size

§ m_nPreemptiveInstructionCount

int32 NPL::CNeuronFileState::m_nPreemptiveInstructionCount
protected

if not 0, we will use coroutine and debug hook to simulate preemptive scheduling in user mode.

§ m_nTotalActivations

int32 NPL::CNeuronFileState::m_nTotalActivations
protected

total number of activations since program starts.


The documentation for this class was generated from the following files: