Beispiel #1
0
bool CTrackedNodeMgr::LinkNodes( HTRACKEDNODE ChildID, HTRACKEDNODE ParentID )
{
	//make sure the nodes are valid
	if(!CheckValidity(ChildID) || !CheckValidity(ParentID))
		return false;

	ParentID->m_pChild = ChildID;
	return true;
}
Beispiel #2
0
int CWavFile::IsCanCombine(CString strPathL, CString strPathR)
{
	BOOL b = FALSE;
	DWORD m_dwDataSizeL = 0;
	DWORD m_dwDataSizeR = 0;

	memset(&m_formatL, 0, sizeof(WAVEFORMATEX));
	memset(&m_formatR, 0, sizeof(WAVEFORMATEX));
	ZeroMemory(&m_mmckinfoParent, sizeof(MMCKINFO));
	ZeroMemory(&m_mmckinfoSubChunk, sizeof(MMCKINFO));
	
	// Check Validity of the first(left channel) file
	m_dwDataSizeL = CheckValidity(m_hWaveFileL, strPathL, m_formatL);
	if(m_dwDataSizeL == -1)
	{
		MyMessageBox(_T("Invalid wave file: ") + strPathL, eERR_ERROR);
		return -1;
	}

	// Check Validity of the second(right channel) file
	m_dwDataSizeR = CheckValidity(m_hWaveFileR, strPathR, m_formatR);
	if(m_dwDataSizeR == -1)
	{
		MyMessageBox(_T("Invalid wave file: ") + strPathR, eERR_ERROR);
		return -1;
	}

	// All of them must be mono wave file
	if(!(m_formatL.nChannels == 1))
	{
		MyMessageBox(_T("Not a mono wave file: ") + strPathL, eERR_ERROR);
		return -1;
	}
	if(!(m_formatR.nChannels == 1))
	{
		MyMessageBox(_T("Not a mono wave file: ") + strPathR, eERR_ERROR);
		return -1;
	}

	// They must have the same bps
	if(!(m_formatL.wBitsPerSample == m_formatR.wBitsPerSample))
	{
		MyMessageBox(_T("They must have the same bps"), eERR_ERROR);
		return -1;
	}

	// They must have the same sps
	if(m_formatL.nSamplesPerSec != m_formatR.nSamplesPerSec)
	{
		MyMessageBox(_T("They must have the same sps"), eERR_ERROR);
		return -1;
	}

	return max(m_dwDataSizeL, m_dwDataSizeR);
}
Beispiel #3
0
bool CTrackedNodeMgr::LinkNodeOrientation(	HTRACKEDNODE ID,
											HTRACKEDNODE CopyFrom )
{
	//check the params and parent object
	if(!CheckValidity(ID) || !CheckValidity(CopyFrom))
		return false;

	//ok, setup the link pointer
	ID->m_pMimicNode = CopyFrom;

	//success
	return true;
}
Beispiel #4
0
GridDefinition::GridDefinition(const float xRange[2], const float yRange[2], float pRadius, float pSpacing)
	: xMin(xRange[0]), xMax(xRange[1]), yMin(yRange[0]), yMax(yRange[1]), radius(pRadius), spacing(pSpacing), recipSpacing(1.0/spacing)
{
	numX = (xMax - xMin >= MinRange && spacing >= MinSpacing) ? (uint32_t)((xMax - xMin) * recipSpacing) + 1 : 0;
	numY = (yMax - yMin >= MinRange && spacing >= MinSpacing) ? (uint32_t)((yMax - yMin) * recipSpacing) + 1 : 0;
	CheckValidity();
}
Beispiel #5
0
/********************************************************************

  Savcor IT Oy/JLM
  Borland TURBO C++ 3.0
  Declaration: Parse received message
  Call: ret=ParseMessage(ReceiveBuffer)
  Input:  char *ReceiveBuffer
  Returns:  char *ret
  01.12.2000 Initial coding  JLM

*********************************************************************/
 void ParseMessage(char *OutMes)
  {
  int i;
  int j=0;
  char token[BUFFER_SIZE];

  strcpy(OutMes,"");
  strcpy(tempbuf,"");

  for (i=1;i<(int)strlen(Message);i++)
    {		

    if (IsAlpha(Message[i]) && ( i < ((int)strlen(Message)-1)))
      token[j++]=Message[i];
    else
      {
       if (j>0)
        {
          token[j]=0;  // end of string
          strcpy(tempbuf,"");				
          CheckValidity(token); 
          if ( (!DispWithoutLabels) && (strlen(tempbuf)>0))
          {
           strcat(OutMes,token);
           strcat(OutMes,"=");
          }
          strcat(OutMes,tempbuf);
					//printf ("OutMes=%s\n",OutMes);
        }
       j=0;
			} // else
    }
  }
Beispiel #6
0
bool CTrackedNodeMgr::IsLookingAtTarget( HTRACKEDNODE ID)
{
	if(!CheckValidity(ID))
		return false;

	return ID->m_bLookingAtTarget;
}
Beispiel #7
0
bool CSettingString::SetValue(const std::string &value)
{
  CSingleLock lock(m_critical);

  if (value == m_value)
    return true;
    
  if (!CheckValidity(value))
    return false;

  std::string oldValue = m_value;
  m_value = value;

  if (!OnSettingChanging(this))
  {
    m_value = oldValue;

    // the setting couldn't be changed because one of the
    // callback handlers failed the OnSettingChanging()
    // callback so we need to let all the callback handlers
    // know that the setting hasn't changed
    OnSettingChanging(this);
    return false;
  }

  m_changed = m_value != m_default;
  OnSettingChanged(this);
  return true;
}
Beispiel #8
0
bool CTrackedNodeMgr::SetTarget( HTRACKEDNODE ID, HOBJECT hModel, HMODELNODE hNode, const LTVector& vOffset )
{
	if(!CheckValidity(ID))
		return false;

	//make sure that the model pointed to is not ourself, this can cause infinite
	//recursion
	assert(hModel != ID->m_hModel);

	//make sure that that is actually a valid model
	uint32 nType;
	if(m_pILTBase->Common()->GetObjectType(hModel, &nType) != LT_OK)
		return false;

	if(nType != OT_MODEL)
		return false;

	//make sure we have a valid node
	if(hNode == INVALID_MODEL_NODE)
		return false;

	//setup this target
	ID->m_eTrackMode	= CTrackedNode::TRACK_NODE;
	ID->m_hTrackObject	= hModel;
	ID->m_hTrackNode	= hNode;
	ID->m_vTrackOffset	= vOffset;

	//success
	return true;
}
Beispiel #9
0
bool CSettingNumber::SetValue(double value)
{
  CExclusiveLock lock(m_critical);

  if (value == m_value)
    return true;

  if (!CheckValidity(value))
    return false;

  double oldValue = m_value;
  m_value = value;

  if (!OnSettingChanging(this))
  {
    m_value = oldValue;

    // the setting couldn't be changed because one of the
    // callback handlers failed the OnSettingChanging()
    // callback so we need to let all the callback handlers
    // know that the setting hasn't changed
    OnSettingChanging(this);
    return false;
  }

  m_changed = m_value != m_default;
  OnSettingChanged(this);
  return true;
}
Beispiel #10
0
bool CTrackedNodeMgr::IsAtDiscomfort( HTRACKEDNODE ID)
{
	if(!CheckValidity(ID))
		return false;

	return ID->m_bInDiscomfort;
}
Beispiel #11
0
bool CTrackedNodeMgr::IsTracking( HTRACKEDNODE ID )
{
	if(!CheckValidity(ID))
		return false;

	return ID->m_bEnabled;
}
Beispiel #12
0
bool CTrackedNodeMgr::IsAtLimit( HTRACKEDNODE ID )
{
	if(!CheckValidity(ID))
		return false;

	return ID->m_bAtMaxThreshold;
}
Beispiel #13
0
//m_month setter w/ error checking
void cDate::SetMonth(uint8_t month)
{
	if (month <= 12 && month != 0)
	{
		m_month = month;
		CheckValidity();
	}
}
Beispiel #14
0
bool CSettingInt::CheckValidity(const std::string &value) const
{
  int iValue;
  if (!fromString(value, iValue))
    return false;

  return CheckValidity(iValue);
}
Beispiel #15
0
bool CSettingNumber::CheckValidity(const std::string &value) const
{
  double dValue;
  if (!fromString(value, dValue))
    return false;

  return CheckValidity(dValue);
}
Beispiel #16
0
// m_day setter w/ error checking
void cDate::SetDay(uint8_t day)
{
	if (day <= 31 && day != 0)
	{
		m_day = day;
		CheckValidity();
	}
}
Beispiel #17
0
bool CTrackedNodeMgr::SetOrientOnAnim( HTRACKEDNODE ID, bool bTrackOnAnim )
{
	if(!CheckValidity(ID))
		return false;

	//just set the flag on the node
	ID->m_bOrientFromAnim = bTrackOnAnim;
	return true;
}
Beispiel #18
0
bool CTrackedNodeMgr::SetIgnoreParentAnimation( HTRACKEDNODE ID, bool bIgnoreParentAnimation )
{
	if(!CheckValidity(ID))
		return false;

	//just set the flag on the node
	ID->m_bIgnoreParentAnimation = bIgnoreParentAnimation;
	return true;
}
nsresult
nsIConstraintValidation::CheckValidity(bool* aValidity)
{
  NS_ENSURE_ARG_POINTER(aValidity);

  *aValidity = CheckValidity();

  return NS_OK;
}
Beispiel #20
0
bool CTrackedNodeMgr::SetAutoDisable( HTRACKEDNODE ID, bool bAutoDisable )
{
	if(!CheckValidity(ID))
		return false;

	//just set the flag on the node
	ID->m_bAutoDisable = bAutoDisable;
	return true;
}
Beispiel #21
0
	void KTorrentImportPage::initializePage ()
	{
		connect (wizard (),
				SIGNAL (accepted ()),
				this,
				SLOT (handleAccepted ()));

		QString defaultFile = QDir::homePath () + "/.kde/share/config/ktorrentrc";
		if (CheckValidity (defaultFile))
			Ui_.FileLocation_->setText (defaultFile);
	}
Beispiel #22
0
bool CTrackedNodeMgr::SetTargetObject( HTRACKEDNODE ID, const LTVector& vPosition )
{
	if(!CheckValidity(ID))
		return false;

	//setup this target
	ID->m_eTrackMode	= CTrackedNode::TRACK_OBJSPACEPOS;
	ID->m_vTrackOffset	= vPosition;

	return true;
}
Beispiel #23
0
Trajectory PlanningProblem::RRT_APF_Solve(const ObstacleSet &ob_set,
                                           Trajectory &prior_plan,
                                           bool stop_when_collid)
{
    Trajectory *temp_trajec = new Trajectory();
    temp_trajec->appendState(initialState);

    for(int step = 1; step <= MAX_APF_STEP_TRY; step++) {
        // check reaching the goal state
        Station current_station = temp_trajec->getLastStation();
        if( (goal.minDistTo(current_station) < agent->radius() * 1) )
        {
            temp_trajec->appendState(goal.goal_point);
            planningResult = true;
            break;
        }

        Vector2D total_force;
        if( !pathHasCollision(current_station, goal.goal_point, ob_set) ) {
//            temp_trajec->appendState(goal.goal_point);
//            planningResult = true;
//            break;
            total_force += GoalAttractiveForce(current_station);
        }

//        else
        {
            Station next_goal = getNextStation(current_station, prior_plan);
            total_force += PathDirectedForce(current_station, prior_plan);
            vector<Vector2D> ob_forces = ObstacleForces(current_station, ob_set);
            Vector2D ob_total_force;
            for(uint i=0; i<ob_forces.size(); i++)  {
                ob_total_force += ob_forces[i];
            }
            if(!pathHasCollision(current_station, next_goal, ob_set)) {
                ob_total_force *= 0.2;
            }
            total_force += ob_total_force;
        }

        Station new_station;
        new_station = agent->step(current_station,
                                  (total_force.normalized()).to3D(),
                                  0.080 /*sec*/);
        temp_trajec->appendState(new_station);
        if(stop_when_collid) {
            if( !CheckValidity(new_station) ) {
                planningResult = false;
                break;
            }
        }
    }
    return *temp_trajec;
}
Beispiel #24
0
bool CTrackedNodeMgr::SetTarget( HTRACKEDNODE ID, HOBJECT hObject, const LTVector& vOffset )
{
	if(!CheckValidity(ID))
		return false;

	//setup this target
	ID->m_eTrackMode	= CTrackedNode::TRACK_OBJECT;
	ID->m_hTrackObject	= hObject;
	ID->m_vTrackOffset	= vOffset;

	return true;
}
Beispiel #25
0
Station PlanningProblem::SampleStateUniform()
{
    Station sampled_station;
    for(int i=0; i < MAX_SAMPLING_TRY; ++i)
    {
        Vector3D rand_pos = actualBound->getUniformSample();
        sampled_station.setPosition(rand_pos);
        if(CheckValidity(sampled_station))
            return sampled_station;
    }
    return Station();
}
Beispiel #26
0
bool CTrackedNodeMgr::TargetAnimation( HTRACKEDNODE ID, const LTVector& vOffset )
{
	if(!CheckValidity(ID))
		return false;

	//setup the target
	ID->m_eTrackMode	= CTrackedNode::TRACK_ANIMATION;
	ID->m_vTrackOffset	= vOffset;

	//success
	return true;
}
Beispiel #27
0
// Read the grid parameters from a string returning true if success
bool GridDefinition::ReadParameters(const StringRef& s)
{
	bool ok = (sscanf(s.Pointer(), "%f,%f,%f,%f,%f,%f,%lu,%lu", &xMin, &xMax, &yMin, &yMax, &radius, &spacing, &numX, &numY) == 8);
	if (ok)
	{
		CheckValidity();
		recipSpacing = 1.0 / spacing;
	}
	else
	{
		isValid = false;
	}
	return ok;
}
/* Function definition */
int * GenerateInitPopulation(unsigned int** dMat)
{
  int i, city;

  int *initialPopulation = (int *)malloc(sizeof(int) * NUM_CITIES * NUM_CITIES) ;

  for(city ; city < NUM_CITIES; city++)
  {
     GenerateTour(city + 1, &initialPopulation[city  * NUM_CITIES], dMat);
     CheckValidity(&initialPopulation[city  * NUM_CITIES] , "init");
  }

  return initialPopulation;
}
Beispiel #29
0
bool CTrackedNodeMgr::GetOrientationSpace( HTRACKEDNODE ID,	LTVector& vRight, 
											LTVector& vUp, 
											LTVector& vForward)
{
	if(!CheckValidity(ID))
		return false;

	//read in the vectors
	LTMatrix mTargetTransform = ID->m_mInvTargetTransform;
	mTargetTransform.Transpose();

	mTargetTransform.GetBasisVectors(&vRight, &vUp, &vForward);
	return true;
}
Beispiel #30
0
bool CTrackedNodeMgr::GetBasisSpace( HTRACKEDNODE ID,	LTVector& vRight, 
														LTVector& vUp, 
														LTVector& vForward,
														LTVector& vPos)
{
	if(!CheckValidity(ID))
		return false;

	vRight		= ID->m_vActualRight;
	vUp			= ID->m_vActualUp;
	vForward	= ID->m_vActualForward;
	vPos		= ID->m_vActualPos;

	return true;
}