/*--------------------------------------------------------------------------*
 * File Name:	ScopeObj.cpp												*
 * Purpose:		Demostrate realtime update on a graph						*
 * Creation:	April 04, 2000												*
 * Copyright (c) 2000 Microcal Software, Inc.								*
 *																			*
 * Modification Log:														*
 *--------------------------------------------------------------------------*/      

#include "ScopeObj.h"


//---------------------------------------------------------------------------
// MOCA_ENTRY_POINT( <main object class> )
//
// This is the main object. A Moca project can have one and only one main
// object decleared by the above command which communicates with Origin.
//---------------------------------------------------------------------------
MOCA_ENTRY_POINT(CScopeObj)


//---------------------------------------------------------------------------
// Property Map:
//
// The Property Map is for declaring the properties of your LabTalk object.
//
// A property is mapped to Get and Set function.  These functions allow
// you to do error checking or any necessary conversions.  A read-only
// property can be declared by using the _GET macro.
//
// MOCA_PROP_INT( <GetFunction>,<SetFunction>,<PropertyNameStr> )
// MOCA_PROP_REAL( <GetFunction>,<SetFunction>,<PropertyNameStr> )
// MOCA_PROP_STR( <GetFunction>,<SetFunction>,<PropertyNameStr> )
// MOCA_PROP_INT_GET( <GetFunction>,<PropertyNameStr> )
// MOCA_PROP_REAL_GET( <GetFunction>,<PropertyNameStr> )
// MOCA_PROP_STR_GET( <GetFunction>,<PropertyNameStr> )
//
// A Simple Property is mapped to a data member.  There are no Get/Set
// functions for a Simple Property.  MOCA will take care of the assignment.
// A simple read-only property can be declared by using the _GET macro.
//
// MOCA_SIMPLE_PROP_INT( <DataMember>,<PropertyNameStr> )
// MOCA_SIMPLE_PROP_REAL( <DataMember>,<PropertyNameStr> )
// MOCA_SIMPLE_PROP_STR( <DataMember>,<PropertyNameStr> )
// MOCA_SIMPLE_PROP_INT_GET( <DataMember>,<PropertyNameStr> )
// MOCA_SIMPLE_PROP_REAL_GET( <DataMember>,<PropertyNameStr> )
// MOCA_SIMPLE_PROP_STR_GET( <DataMember>,<PropertyNameStr> )
//---------------------------------------------------------------------------
MOCA_BEGIN_PROP_MAP(CScopeObj, CMOCAObjBase)
	MOCA_PROP_INT(GetNumPoints, SetNumPoints, "NumPoints")
	MOCA_PROP_STR(GetWksName, SetWksName, "WksName")
MOCA_END_PROP_MAP(CScopeObj, CMOCAObjBase)


//---------------------------------------------------------------------------
// Method Map:
//
// INPORTANT: To have a Method Map or a SubObject Map, you must
// have a property map.  A property map can be empty.
//
// MOCA_METH_ENTRY( <MemberFunction>,<MethodNameStr> )
//
// <MemberFunction> must be declared as "BOOL foo(double &, CStringArray &);"
// The double is used for storing LabTalk's return value.
// The CStringArray contains the arguments passed from LabTalk.
//---------------------------------------------------------------------------
MOCA_BEGIN_METH_MAP(CScopeObj, CMOCAObjBase)
//	MOCA_METH_ENTRY(Meth_Test, "Test")	
MOCA_END_METH_MAP(CScopeObj, CMOCAObjBase)


//---------------------------------------------------------------------------
// SubObject Map:
//
// INPORTANT: To have a Method Map or a SubObject Map, you must
// have a property map.  A property map can be empty.
//
// MOCA_SUBOBJ_ENTRY( <m_SubObject>,<SubObjectNameStr> )
//
//---------------------------------------------------------------------------
MOCA_BEGIN_SUBOBJ_MAP(CScopeObj, CMOCAObjBase)
	MOCA_SUBOBJ_ENTRY(m_ThreadSubObj, "Thread")
MOCA_END_SUBOBJ_MAP(CScopeObj, CMOCAObjBase)


//---------------------------------------------------------------------------
CScopeObj::CScopeObj()
{
}

CScopeObj::~CScopeObj()
{
}

//---------------------------------------------------------------------------
BOOL CScopeObj::GetNumPoints(int &iValue)
{
	iValue = m_ThreadSubObj.m_iNumPoints;
	return TRUE;
}

BOOL CScopeObj::SetNumPoints(int iValue)
{
	if( iValue >= 2 && iValue <= 1000 )
	{
		m_ThreadSubObj.m_iNumPoints = iValue;
		return TRUE;
	}
	return FALSE;
}

//---------------------------------------------------------------------------
BOOL CScopeObj::GetWksName(LPSTR lpstr)
{
	lstrcpy(lpstr, m_ThreadSubObj.m_strWksName);
	return TRUE;
}

BOOL CScopeObj::SetWksName(LPCSTR lpcstr)
{
	m_ThreadSubObj.m_strWksName = lpcstr;
	return TRUE;
}

