jp.go.aist.rtm.RTC
Class PeriodicTask

java.lang.Object
  extended by java.lang.Thread
      extended by jp.go.aist.rtm.RTC.PeriodicTaskBase
          extended by jp.go.aist.rtm.RTC.PeriodicTask
All Implemented Interfaces:
java.lang.Runnable, ObjectCreator<PeriodicTaskBase>, ObjectDestructor

public class PeriodicTask
extends PeriodicTaskBase
implements ObjectCreator<PeriodicTaskBase>, ObjectDestructor

PeriodicTask class


Nested Class Summary
protected  class PeriodicTask.alive_t
           alive_t class
protected  class PeriodicTask.statistics_t
           Structure for task execution time measurement management
protected  class PeriodicTask.suspend_t
           Class for task suspend management
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  PeriodicTask.alive_t m_alive
           Task alive flag
protected  boolean m_deleteInDtor
           Task execution function delete flag
protected  int m_execCount
           Task execution time measurement count
protected  int m_execCountMax
           Task execution time measurement max count
protected  boolean m_execMeasure
           Task execution time measurement flag
protected  PeriodicTask.statistics_t m_execStat
           Task execution time measurement statistics
protected  TimeMeasure m_execTime
           Task execution time measurement infomation
protected  TaskFuncBase m_func
           Task execution function
protected  boolean m_nowait
           Thread sleep flag
protected  TimeValue m_period
           Task execution period
protected  int m_periodCount
           Task periodic time measurement count
protected  int m_periodCountMax
           Task periodic time measurement max count
protected  boolean m_periodMeasure
           Task periodic time measurement flag
protected  PeriodicTask.statistics_t m_periodStat
           Task periodic time measurement statistics
protected  TimeMeasure m_periodTime
           Task periodic time measurement infomation
protected  PeriodicTask.suspend_t m_suspend
           Task suspend infomation
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PeriodicTask()
           Constructor
 
Method Summary
 void _finalize()
           Finalizing the task
 int _resume()
           Resuming the suspended task
 int _suspend()
           Suspending the task
 void activate()
           Starting the task
 PeriodicTaskBase creator_()
           Creats PeriodicTask.
 void destructor_(java.lang.Object obj)
           Destroys the object.
 void executionMeasure(boolean value)
           Validate a Task execute time measurement
 void executionMeasureCount(int n)
           Task period time measurement count
 TimeMeasure.Statistics getExecStat()
           Get a result in task execute time measurement
 TimeMeasure.Statistics getPeriodStat()
           Get a result in task period time measurement
 void periodicMeasure(boolean value)
           Validate a Task period time measurement
 void periodicMeasureCount(int n)
           Task period time measurement count
static void PeriodicTaskInit()
           Initialization
 void run()
           Thread execution
 void setPeriod(double period)
           Setting task execution period
 void setPeriod(TimeValue period)
           Setting task execution period
 boolean setTask(java.lang.Object obj)
           Setting task execution function
 boolean setTask(java.lang.Object obj, boolean delete_in_dtor)
           Setting task execution function
 boolean setTask(java.lang.Object obj, java.lang.String func)
           Setting task execution function
 boolean setTask(java.lang.Object obj, java.lang.String func, boolean delete_in_dtor)
           Setting task execution function
 void signal()
           Executing the suspended task one tick
protected  void sleep()
           Thread sleep
protected  int svc()
           Thread execution for PeriodicTask
protected  void updateExecStat()
           Update for execute state
protected  void updatePeriodStat()
           Update for period state
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_period

protected TimeValue m_period
Task execution period


m_nowait

protected boolean m_nowait
Thread sleep flag


m_func

protected TaskFuncBase m_func
Task execution function


m_deleteInDtor

protected boolean m_deleteInDtor
Task execution function delete flag


m_alive

protected PeriodicTask.alive_t m_alive
Task alive flag


m_suspend

protected PeriodicTask.suspend_t m_suspend
Task suspend infomation


m_execMeasure

protected boolean m_execMeasure
Task execution time measurement flag


m_execCount

protected int m_execCount
Task execution time measurement count


m_execCountMax

protected int m_execCountMax
Task execution time measurement max count


m_execStat

protected PeriodicTask.statistics_t m_execStat
Task execution time measurement statistics


m_execTime

protected TimeMeasure m_execTime
Task execution time measurement infomation


m_periodMeasure

protected boolean m_periodMeasure
Task periodic time measurement flag


m_periodCount

protected int m_periodCount
Task periodic time measurement count


m_periodCountMax

protected int m_periodCountMax
Task periodic time measurement max count


m_periodStat

protected PeriodicTask.statistics_t m_periodStat
Task periodic time measurement statistics


m_periodTime

protected TimeMeasure m_periodTime
Task periodic time measurement infomation

Constructor Detail

PeriodicTask

public PeriodicTask()
Constructor

Method Detail

activate

public void activate()
Starting the task

Starting a thread to execute a task. If the task/thread is started properly, it will return 'TRUE'. if the task/thread are already started or task function object is not set, 'FALSE' will be returned.

Specified by:
activate in class PeriodicTaskBase

_finalize

public void _finalize()
Finalizing the task

Finalizing the task running.

Specified by:
_finalize in class PeriodicTaskBase

_suspend

public int _suspend()
Suspending the task

Suspending the task running.

Specified by:
_suspend in class PeriodicTaskBase

_resume

public int _resume()
Resuming the suspended task

Resuming the suspended task

Specified by:
_resume in class PeriodicTaskBase

signal

public void signal()
Executing the suspended task one tick

Executing the suspended task one tick

Specified by:
signal in class PeriodicTaskBase

setTask

public boolean setTask(java.lang.Object obj,
                       java.lang.String func,
                       boolean delete_in_dtor)
Setting task execution function

Specified by:
setTask in class PeriodicTaskBase
Parameters:
obj - Object
func - Function name
delete_in_dtor - Delete flag.

setTask

public boolean setTask(java.lang.Object obj)
Setting task execution function

Specified by:
setTask in class PeriodicTaskBase
Parameters:
obj - object

setTask

public boolean setTask(java.lang.Object obj,
                       java.lang.String func)
Setting task execution function

Specified by:
setTask in class PeriodicTaskBase
Parameters:
obj - Object
func - Function name

setTask

public boolean setTask(java.lang.Object obj,
                       boolean delete_in_dtor)
Setting task execution function

Specified by:
setTask in class PeriodicTaskBase
Parameters:
obj - Object
delete_in_dtor - Delete flag.

setPeriod

public void setPeriod(double period)
Setting task execution period

Specified by:
setPeriod in class PeriodicTaskBase
Parameters:
period - Execution period [sec]

setPeriod

public void setPeriod(TimeValue period)
Setting task execution period

Specified by:
setPeriod in class PeriodicTaskBase
Parameters:
period - period Execution period

executionMeasure

public void executionMeasure(boolean value)
Validate a Task execute time measurement

This function can set the measurement of the execution time effective/invalidly.

Specified by:
executionMeasure in class PeriodicTaskBase
Parameters:
value - true:effectuation

executionMeasureCount

public void executionMeasureCount(int n)
Task period time measurement count

This function sets the cycle to measure the execution time.

Specified by:
executionMeasureCount in class PeriodicTaskBase
Parameters:
n - Cycle frequency

periodicMeasure

public void periodicMeasure(boolean value)
Validate a Task period time measurement

This function can set the measurement of the execution time effective/invalidly.

Specified by:
periodicMeasure in class PeriodicTaskBase
Parameters:
value - true:effectuation

periodicMeasureCount

public void periodicMeasureCount(int n)
Task period time measurement count

This function sets the cycle to measure the execution time.

Specified by:
periodicMeasureCount in class PeriodicTaskBase
Parameters:
n - Cycle frequency

getExecStat

public TimeMeasure.Statistics getExecStat()
Get a result in task execute time measurement

This function acquires the measurement result of the execution time.

Specified by:
getExecStat in class PeriodicTaskBase
Returns:
Statistics

getPeriodStat

public TimeMeasure.Statistics getPeriodStat()
Get a result in task period time measurement

This function acquires the measurement result at time of the cycle.

Specified by:
getPeriodStat in class PeriodicTaskBase
Returns:
Statistics

svc

protected int svc()
Thread execution for PeriodicTask


run

public void run()
Thread execution

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

sleep

protected void sleep()
Thread sleep


updateExecStat

protected void updateExecStat()
Update for execute state


updatePeriodStat

protected void updatePeriodStat()
Update for period state


creator_

public PeriodicTaskBase creator_()
Creats PeriodicTask.

Specified by:
creator_ in interface ObjectCreator<PeriodicTaskBase>
Returns:
Object Created PeriodicTaskBase

destructor_

public void destructor_(java.lang.Object obj)
Destroys the object.

Specified by:
destructor_ in interface ObjectDestructor
Parameters:
obj - The target instances for destruction

PeriodicTaskInit

public static void PeriodicTaskInit()
Initialization

Adds the object to the factory.