<commit_before>/**********************************************************************
 * $Id$
 *
 * GEOS - Geometry Engine Open Source
 * http://geos.refractions.net
 *
 * Copyright (C) 2001-2002 Vivid Solutions Inc.
 *
 * This is free software; you can redistribute and/or modify it under
 * the terms of the GNU Lesser General Licence as published
 * by the Free Software Foundation.
 * See the COPYING file for more information.
 *
 **********************************************************************
 * $Log$
 * Revision 1.4  2004/05/03 22:56:44  strk
 * leaks fixed, exception specification omitted.
 *
 * Revision 1.3  2004/04/19 16:14:52  strk
 * Some memory leaks plugged in noding algorithms.
 *
 * Revision 1.2  2004/04/16 12:48:07  strk
 * Leak fixes.
 *
 * Revision 1.1  2004/03/26 07:48:30  ybychkov
 * "noding" package ported (JTS 1.4)
 *
 *
 **********************************************************************/

#include "../headers/noding.h"

namespace geos {

MCQuadtreeNoder::MCQuadtreeNoder(){
	chains=new vector<indexMonotoneChain*>();
	index=new STRtree();
	idCounter = 0;
	nOverlaps = 0;
}

MCQuadtreeNoder::~MCQuadtreeNoder(){
	for (int i=0; i<chains->size(); i++)
	{
		delete (*chains)[i];
	}
	delete chains;
	delete index;
}
vector<SegmentString*> *
MCQuadtreeNoder::node(vector<SegmentString*> *inputSegStrings)
{
	for(int i=0; i<(int)inputSegStrings->size();i++) {
		add((*inputSegStrings)[i]);
	}
	intersectChains();
	//System.out.println("MCQuadtreeNoder: # chain overlaps = " + nOverlaps);
	vector<SegmentString*> *nodedSegStrings=getNodedEdges(inputSegStrings);
	return nodedSegStrings;
}

void MCQuadtreeNoder::intersectChains() {
	MonotoneChainOverlapAction *overlapAction = new SegmentOverlapAction(segInt);
	for (int i=0; i<(int)chains->size();i++) {
		indexMonotoneChain *queryChain=(*chains)[i];
		vector<void*> *overlapChains =index->query(queryChain->getEnvelope());
		for (int j=0; j<(int)overlapChains->size();j++) {
			indexMonotoneChain *testChain=(indexMonotoneChain*)(*overlapChains)[j];
			/**
			* following test makes sure we only compare each pair of chains once
			* and that we don't compare a chain to itself
			*/
			if (testChain->getId()>queryChain->getId()) {
				queryChain->computeOverlaps(testChain, overlapAction);
				nOverlaps++;
			}
		}
	}

	delete overlapAction;
}

void MCQuadtreeNoder::add(SegmentString *segStr) {
	vector<indexMonotoneChain*> *segChains=MonotoneChainBuilder::getChains((CoordinateList*)segStr->getCoordinates(),segStr);
	for (int i=0; i<(int)segChains->size();i++) {
		indexMonotoneChain *mc=(*segChains)[i];
		mc->setId(idCounter++);
		index->insert(mc->getEnvelope(), mc);
		chains->push_back(mc);
	}
	delete segChains;
}

MCQuadtreeNoder::SegmentOverlapAction::SegmentOverlapAction(nodingSegmentIntersector *newSi){
	si=newSi;
}

void MCQuadtreeNoder::SegmentOverlapAction::overlap(indexMonotoneChain *mc1, int start1, indexMonotoneChain *mc2, int start2) {
	SegmentString *ss1=(SegmentString*) mc1->getContext();
	SegmentString *ss2=(SegmentString*) mc2->getContext();
	si->processIntersections(ss1, start1, ss2, start2);
}

}

<commit_msg>Fixed big leak in intersectChains()<commit_after>/**********************************************************************
 * $Id$
 *
 * GEOS - Geometry Engine Open Source
 * http://geos.refractions.net
 *
 * Copyright (C) 2001-2002 Vivid Solutions Inc.
 *
 * This is free software; you can redistribute and/or modify it under
 * the terms of the GNU Lesser General Licence as published
 * by the Free Software Foundation.
 * See the COPYING file for more information.
 *
 **********************************************************************
 * $Log$
 * Revision 1.5  2004/05/05 15:51:29  strk
 * Fixed big leak in intersectChains()
 *
 * Revision 1.4  2004/05/03 22:56:44  strk
 * leaks fixed, exception specification omitted.
 *
 * Revision 1.3  2004/04/19 16:14:52  strk
 * Some memory leaks plugged in noding algorithms.
 *
 * Revision 1.2  2004/04/16 12:48:07  strk
 * Leak fixes.
 *
 * Revision 1.1  2004/03/26 07:48:30  ybychkov
 * "noding" package ported (JTS 1.4)
 *
 *
 **********************************************************************/

#include "../headers/noding.h"

namespace geos {

MCQuadtreeNoder::MCQuadtreeNoder(){
	chains=new vector<indexMonotoneChain*>();
	index=new STRtree();
	idCounter = 0;
	nOverlaps = 0;
}

MCQuadtreeNoder::~MCQuadtreeNoder(){
	for (int i=0; i<chains->size(); i++)
	{
		delete (*chains)[i];
	}
	delete chains;
	delete index;
}
vector<SegmentString*> *
MCQuadtreeNoder::node(vector<SegmentString*> *inputSegStrings)
{
	for(int i=0; i<(int)inputSegStrings->size();i++) {
		add((*inputSegStrings)[i]);
	}
	intersectChains();
	//System.out.println("MCQuadtreeNoder: # chain overlaps = " + nOverlaps);
	vector<SegmentString*> *nodedSegStrings=getNodedEdges(inputSegStrings);
	return nodedSegStrings;
}

void MCQuadtreeNoder::intersectChains() {
	MonotoneChainOverlapAction *overlapAction = new SegmentOverlapAction(segInt);
	for (int i=0; i<(int)chains->size();i++) {
		indexMonotoneChain *queryChain=(*chains)[i];
		vector<void*> *overlapChains =index->query(queryChain->getEnvelope());
		for (int j=0; j<(int)overlapChains->size();j++) {
			indexMonotoneChain *testChain=(indexMonotoneChain*)(*overlapChains)[j];
			/**
			* following test makes sure we only compare each pair of chains once
			* and that we don't compare a chain to itself
			*/
			if (testChain->getId()>queryChain->getId()) {
				queryChain->computeOverlaps(testChain, overlapAction);
				nOverlaps++;
			}
		}
		delete overlapChains;
	}

	delete overlapAction;
}

void MCQuadtreeNoder::add(SegmentString *segStr) {
	vector<indexMonotoneChain*> *segChains=MonotoneChainBuilder::getChains((CoordinateList*)segStr->getCoordinates(),segStr);
	for (int i=0; i<(int)segChains->size();i++) {
		indexMonotoneChain *mc=(*segChains)[i];
		mc->setId(idCounter++);
		index->insert(mc->getEnvelope(), mc);
		chains->push_back(mc);
	}
	delete segChains;
}

MCQuadtreeNoder::SegmentOverlapAction::SegmentOverlapAction(nodingSegmentIntersector *newSi){
	si=newSi;
}

void MCQuadtreeNoder::SegmentOverlapAction::overlap(indexMonotoneChain *mc1, int start1, indexMonotoneChain *mc2, int start2) {
	SegmentString *ss1=(SegmentString*) mc1->getContext();
	SegmentString *ss2=(SegmentString*) mc2->getContext();
	si->processIntersections(ss1, start1, ss2, start2);
}

}

<|endoftext|>


<commit_before>//
//  IEpigram.hpp
//  Jigidesign
//
//  Created by Steven Massey on 4/28/13.
//  Copyright (c) 2013 Jigidesign. All rights reserved.
//

#ifndef Jigidesign_IEpigram_h
#define Jigidesign_IEpigram_h

struct IIEpigramIn // : Jd::TypedT <c_jdTypeId::epigram>
{
	struct Payload
	{
		union
		{
			const unsigned char *	bytes;
			const void *			data;
		};

		size_t						size;
	};

//	virtual const unsigned char *	/* payload */		GetPayload			(unsigned int * o_size) const = 0;
	virtual Payload										GetPayload			() const = 0;
};

struct IIEpigramOut : IIEpigramIn
{
	virtual void										Deliver					(const IIEpigramIn * i_epigram) = 0;
	virtual void										Deliver					(const void * i_data, size_t i_size) = 0;
};

typedef IIEpigramOut IIEpigram;

typedef IIEpigramOut * IEpigramOut;
typedef const IIEpigramIn * IEpigramIn;

typedef IIEpigram * IEpigram;

typedef const IIEpigramIn * EpDelivery;
typedef IIEpigram * EpReceiver;

#endif
<commit_msg>no message<commit_after>//
//  IEpigram.hpp
//  Jigidesign
//
//  Created by Steven Massey on 4/28/13.
//  Copyright (c) 2013 Jigidesign. All rights reserved.
//

#ifndef Jigidesign_IEpigram_h
#define Jigidesign_IEpigram_h

#include <stddef.h>

struct IIEpigramIn // : Jd::TypedT <c_jdTypeId::epigram>
{
	struct Payload
	{
		union
		{
			const unsigned char *	bytes;
			const void *			data;
		};

		size_t						size;
	};

//	virtual const unsigned char *	/* payload */		GetPayload			(unsigned int * o_size) const = 0;
	virtual Payload										GetPayload			() const = 0;
};

struct IIEpigramOut : IIEpigramIn
{
	virtual void										Deliver					(const IIEpigramIn * i_epigram) = 0;
	virtual void										Deliver					(const void * i_data, size_t i_size) = 0;
};

typedef IIEpigramOut IIEpigram;

typedef IIEpigramOut * IEpigramOut;
typedef const IIEpigramIn * IEpigramIn;

typedef IIEpigram * IEpigram;

typedef const IIEpigramIn * EpDelivery;
typedef IIEpigram * EpReceiver;

#endif
<|endoftext|>


<commit_before>////////////////////////////////////////////
///
/// WraithOne
/// www.Dark-Abyss.net
///
/// ZFX Action 2014
///
/// Theme: Career, Cell
///
////////////////////////////////////////////

#include <Capp.h>

bool Capp::InitSmuggler()
{
	// Load Prisoner Image
	m_Smuggler = LoadImage(m_Renderer, "Data/GFX/Smuggler.png");
	if (m_Smuggler == nullptr)
	{
		Shutdown();

		return false;
	}

	Smuggler temp;

	// Smuggler 1
	temp.dstRect =			{621, 38, 32, 32};
	temp.srcRect =			{0, 0, 32, 32};
	temp.rotation =			0;
	temp.lastDesisiontime =	90;
	temp.sellGoods =		Cigaretts;
	m_SmugglerList.push_back(temp);

	// Smuggler 2
	temp.dstRect =			{595, 140, 32, 32};
	temp.srcRect =			{0, 0, 32, 32};
	temp.rotation =			0;
	temp.lastDesisiontime =	0;
	temp.sellGoods =		Nothing;
	m_SmugglerList.push_back(temp);

	// Smuggler 3
	temp.dstRect =			{724, 127, 32, 32};
	temp.srcRect =			{0, 0, 32, 32};
	temp.rotation =			0;
	temp.lastDesisiontime =	0;
	temp.sellGoods =		Cocaine;
	m_SmugglerList.push_back(temp);

	return true;
}

void Capp::UpdateSmuggler(unsigned int elapsedTime)
{
	std::vector<Smuggler>::iterator it;
	for (it = m_SmugglerList.begin(); it < m_SmugglerList.end(); it++)
	{
		unsigned int time;
		if (it->lastDesisiontime < elapsedTime)
		{
			time = 0;
		}
		else
		{
			time = it->lastDesisiontime - elapsedTime;
		}
		if (time >= 30000)
		{
			int randnr;

			randnr = rand() % 6 + 1;
			if (randnr == 0)
				it->sellGoods = Nothing;
			if (randnr == 1)
				it->sellGoods = Cigaretts;
			if (randnr == 2)
				it->sellGoods = Weed;
			if (randnr == 3)
				it->sellGoods = Cocaine;
			if (randnr == 4)
				it->sellGoods = Vodka;
			if (randnr == 5)
				it->sellGoods = Wisky;

			it->lastDesisiontime = elapsedTime;
		}
	}

}
void Capp::RenderSmuggler(unsigned int elapsedTime)
{
	std::vector<Smuggler>::iterator it;
	for (it = m_SmugglerList.begin(); it < m_SmugglerList.end(); it++)
	{
		SDL_RenderCopyEx(m_Renderer, m_Smuggler, &it->srcRect, &it->dstRect, it->rotation, NULL, SDL_FLIP_NONE);
	}
}<commit_msg>Updated<commit_after>////////////////////////////////////////////
///
/// WraithOne
/// www.Dark-Abyss.net
///
/// ZFX Action 2014
///
/// Theme: Career, Cell
///
////////////////////////////////////////////

#include <Capp.h>

bool Capp::InitSmuggler()
{
	// Load Prisoner Image
	m_Smuggler = LoadImage(m_Renderer, "Data/GFX/Smuggler.png");
	if (m_Smuggler == nullptr)
	{
		Shutdown();

		return false;
	}

	Smuggler temp;

	// Smuggler 1
	temp.dstRect =			{621, 38, 32, 32};
	temp.sellRect =			{590, 12, 90, 90};
	temp.srcRect =			{0, 0, 32, 32};
	temp.rotation =			90;
	temp.lastDesisiontime =	0;
	temp.sellGoods =		Cigaretts;
	m_SmugglerList.push_back(temp);

	// Smuggler 2
	temp.dstRect =			{595, 140, 32, 32};
	temp.sellRect =			{567, 113, 90, 90};
	temp.srcRect =			{0, 0, 32, 32};
	temp.rotation =			0;
	temp.lastDesisiontime =	4000;
	temp.sellGoods =		Nothing;
	m_SmugglerList.push_back(temp);

	// Smuggler 3
	temp.dstRect =			{724, 127, 32, 32};
	temp.sellRect =			{697,97,90,90};
	temp.srcRect =			{0, 0, 32, 32};
	temp.rotation =			0;
	temp.lastDesisiontime =	8000;
	temp.sellGoods =		Cocaine;
	m_SmugglerList.push_back(temp);

	return true;
}

void Capp::UpdateSmuggler(unsigned int elapsedTime)
{
	std::vector<Smuggler>::iterator it;
	unsigned int time  =  0;

	for (it = m_SmugglerList.begin(); it < m_SmugglerList.end(); it++)
	{
		if (it->lastDesisiontime == 0)
		{
			it->lastDesisiontime = elapsedTime;
		}
		else
		{
			time = elapsedTime - it->lastDesisiontime;
		}

 		if (time >= 10000)
		{
			int randnr;

			randnr = rand() % 6 + 1;
			if (randnr == 0)
				it->sellGoods = Nothing;
			if (randnr == 1)
				it->sellGoods = Cigaretts;
			if (randnr == 2)
				it->sellGoods = Marihuana;
			if (randnr == 3)
				it->sellGoods = Cocaine;
			if (randnr == 4)
				it->sellGoods = Vodka;
			if (randnr == 5)
				it->sellGoods = Wisky;

			it->lastDesisiontime = elapsedTime;
		}
	}

}
void Capp::RenderSmuggler(unsigned int elapsedTime)
{
	std::vector<Smuggler>::iterator it;
	for (it = m_SmugglerList.begin(); it < m_SmugglerList.end(); it++)
	{
		SDL_RenderCopyEx(m_Renderer, m_Smuggler, &it->srcRect, &it->dstRect, it->rotation, NULL, SDL_FLIP_NONE);
	}
}<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: rscpar.hxx,v $
 *
 *  $Revision: 1.3 $
 *
 *  last change: $Author: pl $ $Date: 2001-11-05 14:44:05 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/
#ifndef _RSCPAR_HXX
#define _RSCPAR_HXX

#ifndef _RSCTOOLS_HXX
#include <rsctools.hxx>
#endif
#ifndef _RSCERROR_H
#include <rscerror.h>
#endif

/****************** C L A S S E S ****************************************/
class RscTypCont;
class RscExpression;
/*********** R s c F i l e I n s t ***************************************/

#define READBUFFER_MAX  256
class RscFileInst
{
    ERRTYPE             aFirstError;// Erster Fehler
    USHORT              nErrorLine; // Zeile des ersten Fehlers
    USHORT              nErrorPos;  // Position des ersten Fehlers
    BOOL                bIncLine;   // Muss Zeilennummer incrementiert werden
    USHORT              nLineNo;    // Zeile in der Eingabedatei
    ULONG               lFileIndex; // Index auf Eingabedatei
    ULONG               lSrcIndex;  // Index auf Basisdatei
    FILE *              fInputFile; // Eingabedatei
    char *              pInput;     // Lesepuffer
    USHORT              nInputBufLen; // Laenge des Lesepuffers
    USHORT              nInputPos;  // Position im Lesepuffer
    USHORT              nInputEndPos;// Ende im Lesepuffer
    char *              pLine;      // Zeile
    USHORT              nLineBufLen;//Lange des Zeilenpuffres
    USHORT              nScanPos;   // Position in der Zeile
    int                 cLastChar;
    BOOL                bEof;

public:
    RscTypCont *        pTypCont;
    void    Init();  // ctor initialisieren
            RscFileInst( RscTypCont * pTC, ULONG lIndexSrc,
                         ULONG lFileIndex, FILE * fFile );
            RscFileInst( RscTypCont * pTC, ULONG lIndexSrc,
                         ULONG lFileIndex, const ByteString & );
            ~RscFileInst();
    BOOL    IsEof() const { return bEof; }
    void    SetFileIndex( ULONG lFIndex ) { lFileIndex = lFIndex;  }
    ULONG   GetFileIndex()                { return( lFileIndex );  }
    ULONG   GetSrcIndex()                 { return( lSrcIndex );   }
    void    SetLineNo( USHORT nLine )     { nLineNo = nLine;       }
    USHORT  GetLineNo()                   { return( nLineNo );     }
    USHORT  GetScanPos()                  { return( nScanPos );    }
    char *  GetLine()                     { return( pLine );       }
    int     GetChar();
    int     GetFastChar() { return pLine[ nScanPos ] ?
                                pLine[ nScanPos++ ] : GetChar();
                          }
    void    GetNewLine();
            // Fehlerbehandlung
    void    SetError( ERRTYPE aError );
    ERRTYPE GetError()                    { return aFirstError;    }
    USHORT  GetErrorLine()                { return nErrorLine;     }
    USHORT  GetErrorPos()                 { return nErrorPos;      }
};

/******************* F u n c t i o n *************************************/
void IncludeParser( RscFileInst * pFileInst );
ERRTYPE parser( RscFileInst * pFileInst );
RscExpression * MacroParser( RscFileInst & rFileInst );

#endif // _RSCPAR_HXX
<commit_msg>INTEGRATION: CWS res32bit (1.3.150); FILE MERGED 2004/10/22 13:54:27 pl 1.3.150.1: #i34513# free rsc of 32 bit constraints<commit_after>/*************************************************************************
 *
 *  $RCSfile: rscpar.hxx,v $
 *
 *  $Revision: 1.4 $
 *
 *  last change: $Author: obo $ $Date: 2005-01-03 17:22:42 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/
#ifndef _RSCPAR_HXX
#define _RSCPAR_HXX

#ifndef _RSCTOOLS_HXX
#include <rsctools.hxx>
#endif
#ifndef _RSCERROR_H
#include <rscerror.h>
#endif

/****************** C L A S S E S ****************************************/
class RscTypCont;
class RscExpression;
/*********** R s c F i l e I n s t ***************************************/

#define READBUFFER_MAX  256
class RscFileInst
{
    ERRTYPE             aFirstError;// Erster Fehler
    sal_uInt32              nErrorLine; // Zeile des ersten Fehlers
    sal_uInt32              nErrorPos;  // Position des ersten Fehlers
    BOOL                bIncLine;   // Muss Zeilennummer incrementiert werden
    sal_uInt32              nLineNo;    // Zeile in der Eingabedatei
    ULONG               lFileIndex; // Index auf Eingabedatei
    ULONG               lSrcIndex;  // Index auf Basisdatei
    FILE *              fInputFile; // Eingabedatei
    char *              pInput;     // Lesepuffer
    sal_uInt32              nInputBufLen; // Laenge des Lesepuffers
    sal_uInt32              nInputPos;  // Position im Lesepuffer
    sal_uInt32              nInputEndPos;// Ende im Lesepuffer
    char *              pLine;      // Zeile
    sal_uInt32              nLineBufLen;//Lange des Zeilenpuffres
    sal_uInt32              nScanPos;   // Position in der Zeile
    int                 cLastChar;
    BOOL                bEof;

public:
    RscTypCont *        pTypCont;
    void    Init();  // ctor initialisieren
            RscFileInst( RscTypCont * pTC, ULONG lIndexSrc,
                         ULONG lFileIndex, FILE * fFile );
            RscFileInst( RscTypCont * pTC, ULONG lIndexSrc,
                         ULONG lFileIndex, const ByteString & );
            ~RscFileInst();
    BOOL    IsEof() const { return bEof; }
    void    SetFileIndex( ULONG lFIndex ) { lFileIndex = lFIndex;  }
    ULONG   GetFileIndex()                { return( lFileIndex );  }
    ULONG   GetSrcIndex()                 { return( lSrcIndex );   }
    void    SetLineNo( sal_uInt32 nLine )     { nLineNo = nLine;       }
    sal_uInt32  GetLineNo()                   { return( nLineNo );     }
    sal_uInt32  GetScanPos()                  { return( nScanPos );    }
    char *  GetLine()                     { return( pLine );       }
    int     GetChar();
    int     GetFastChar() { return pLine[ nScanPos ] ?
                                pLine[ nScanPos++ ] : GetChar();
                          }
    void    GetNewLine();
            // Fehlerbehandlung
    void    SetError( ERRTYPE aError );
    ERRTYPE GetError()                    { return aFirstError;    }
    sal_uInt32  GetErrorLine()                { return nErrorLine;     }
    sal_uInt32  GetErrorPos()                 { return nErrorPos;      }
};

/******************* F u n c t i o n *************************************/
void IncludeParser( RscFileInst * pFileInst );
ERRTYPE parser( RscFileInst * pFileInst );
RscExpression * MacroParser( RscFileInst & rFileInst );

#endif // _RSCPAR_HXX
<|endoftext|>


<commit_before>#include "planner_navigation_actions/actionExecutorROSNavigation.h"
#include <pluginlib/class_list_macros.h>

PLUGINLIB_DECLARE_CLASS(planner_navigation_actions, action_executor_ros_navigation,
        planner_navigation_actions::ActionExecutorROSNavigation,
        continual_planning_executive::ActionExecutorInterface)

namespace planner_navigation_actions
{

    void ActionExecutorROSNavigation::initialize(const std::deque<std::string> & arguments)
    {
        ActionExecutorActionlib<move_base_msgs::MoveBaseAction, move_base_msgs::MoveBaseGoal,
            move_base_msgs::MoveBaseResult>::initialize(arguments);

        if(arguments.size() < 3)
            return;

        bool parseStart = true;
        if(arguments[2] == "goal") {
            parseStart = false;
        } else {
            ROS_ASSERT(arguments[2] == "start");
        }

        unsigned int curArg = 3;
        while(curArg < arguments.size()) {
            if(arguments[curArg] == "goal") {
                parseStart = false;
                curArg++;
                continue;
            }
            ROS_ASSERT(arguments.size() > curArg + 2);  // need to access curArg, curArg+1
            string pred = arguments[curArg];
            string setS = arguments[curArg + 1];
            bool set = false;
            if(setS == "true")
                set = true;
            else if(setS == "false")
                set = false;
            else
                ROS_ASSERT(false);
            if(parseStart)
                _startPredicates.push_back(std::make_pair(pred, set));
            else
                _goalPredicates.push_back(std::make_pair(pred, set));
            curArg += 2;
        }
    }

    bool ActionExecutorROSNavigation::fillGoal(move_base_msgs::MoveBaseGoal & goal,
            const DurativeAction & a, const SymbolicState & current)
    {
        // FIXME: don't get from state (very old), but the newest.
        // The frame_id should be a fixed frame anyways
        goal.target_pose.header.stamp = ros::Time::now();

        ROS_ASSERT(a.parameters.size() == 2);
        string targetName = a.parameters[1];

        // extract nicer + warn.
        Predicate p;
        p.parameters.push_back(targetName);
        p.name = "frame-id";
        if(!current.hasObjectFluent(p, &goal.target_pose.header.frame_id))
            return false;
        p.name = "x";
        if(!current.hasNumericalFluent(p, &goal.target_pose.pose.position.x))
            return false;
        p.name = "y";
        if(!current.hasNumericalFluent(p, &goal.target_pose.pose.position.y))
            return false;
        p.name = "z";
        if(!current.hasNumericalFluent(p, &goal.target_pose.pose.position.z))
            return false;
        p.name = "qx";
        if(!current.hasNumericalFluent(p, &goal.target_pose.pose.orientation.x))
            return false;
        p.name = "qy";
        if(!current.hasNumericalFluent(p, &goal.target_pose.pose.orientation.y))
            return false;
        p.name = "qz";
        if(!current.hasNumericalFluent(p, &goal.target_pose.pose.orientation.z))
            return false;
        p.name = "qw";
        if(!current.hasNumericalFluent(p, &goal.target_pose.pose.orientation.w))
            return false;

        ROS_INFO_STREAM("Created goal for ActionExecutorROSNavigation as: " << goal);

        return true;
    }

    void ActionExecutorROSNavigation::updateState(const actionlib::SimpleClientGoalState & actionReturnState,
            const move_base_msgs::MoveBaseResult & result,
            const DurativeAction & a, SymbolicState & current)
    {
        if(actionReturnState == actionlib::SimpleClientGoalState::SUCCEEDED) {
            ROS_ASSERT(a.parameters.size() == 2);
            string startName = a.parameters[0];
            string targetName = a.parameters[1];
            for(std::vector<std::pair<std::string, bool> >::iterator it = _startPredicates.begin();
                    it != _startPredicates.end(); it++) {
                current.setBooleanPredicate(it->first, startName, it->second);
            }
            for(std::vector<std::pair<std::string, bool> >::iterator it = _goalPredicates.begin();
                    it != _goalPredicates.end(); it++) {
                current.setBooleanPredicate(it->first, targetName, it->second);
            }

        }
    }

};

<commit_msg>bugfix in actionExecutorROSNavigation<commit_after>#include "planner_navigation_actions/actionExecutorROSNavigation.h"
#include <pluginlib/class_list_macros.h>

PLUGINLIB_DECLARE_CLASS(planner_navigation_actions, action_executor_ros_navigation,
        planner_navigation_actions::ActionExecutorROSNavigation,
        continual_planning_executive::ActionExecutorInterface)

namespace planner_navigation_actions
{

    void ActionExecutorROSNavigation::initialize(const std::deque<std::string> & arguments)
    {
        ActionExecutorActionlib<move_base_msgs::MoveBaseAction, move_base_msgs::MoveBaseGoal,
            move_base_msgs::MoveBaseResult>::initialize(arguments);

        if(arguments.size() < 3)
            return;

        bool parseStart = true;
        if(arguments[2] == "goal") {
            parseStart = false;
        } else {
            ROS_ASSERT(arguments[2] == "start");
        }

        unsigned int curArg = 3;
        while(curArg < arguments.size()) {
            if(arguments[curArg] == "goal") {
                parseStart = false;
                curArg++;
                continue;
            }
            ROS_ASSERT(arguments.size() >= curArg + 2);  // need to access curArg, curArg+1
            string pred = arguments[curArg];
            string setS = arguments[curArg + 1];
            bool set = false;
            if(setS == "true")
                set = true;
            else if(setS == "false")
                set = false;
            else
                ROS_ASSERT(false);
            if(parseStart)
                _startPredicates.push_back(std::make_pair(pred, set));
            else
                _goalPredicates.push_back(std::make_pair(pred, set));
            curArg += 2;
        }
    }

    bool ActionExecutorROSNavigation::fillGoal(move_base_msgs::MoveBaseGoal & goal,
            const DurativeAction & a, const SymbolicState & current)
    {
        // FIXME: don't get from state (very old), but the newest.
        // The frame_id should be a fixed frame anyways
        goal.target_pose.header.stamp = ros::Time::now();

        ROS_ASSERT(a.parameters.size() == 2);
        string targetName = a.parameters[1];

        // extract nicer + warn.
        Predicate p;
        p.parameters.push_back(targetName);
        p.name = "frame-id";
        if(!current.hasObjectFluent(p, &goal.target_pose.header.frame_id))
            return false;
        p.name = "x";
        if(!current.hasNumericalFluent(p, &goal.target_pose.pose.position.x))
            return false;
        p.name = "y";
        if(!current.hasNumericalFluent(p, &goal.target_pose.pose.position.y))
            return false;
        p.name = "z";
        if(!current.hasNumericalFluent(p, &goal.target_pose.pose.position.z))
            return false;
        p.name = "qx";
        if(!current.hasNumericalFluent(p, &goal.target_pose.pose.orientation.x))
            return false;
        p.name = "qy";
        if(!current.hasNumericalFluent(p, &goal.target_pose.pose.orientation.y))
            return false;
        p.name = "qz";
        if(!current.hasNumericalFluent(p, &goal.target_pose.pose.orientation.z))
            return false;
        p.name = "qw";
        if(!current.hasNumericalFluent(p, &goal.target_pose.pose.orientation.w))
            return false;

        ROS_INFO_STREAM("Created goal for ActionExecutorROSNavigation as: " << goal);

        return true;
    }

    void ActionExecutorROSNavigation::updateState(const actionlib::SimpleClientGoalState & actionReturnState,
            const move_base_msgs::MoveBaseResult & result,
            const DurativeAction & a, SymbolicState & current)
    {
        if(actionReturnState == actionlib::SimpleClientGoalState::SUCCEEDED) {
            ROS_ASSERT(a.parameters.size() == 2);
            string startName = a.parameters[0];
            string targetName = a.parameters[1];
            for(std::vector<std::pair<std::string, bool> >::iterator it = _startPredicates.begin();
                    it != _startPredicates.end(); it++) {
                current.setBooleanPredicate(it->first, startName, it->second);
            }
            for(std::vector<std::pair<std::string, bool> >::iterator it = _goalPredicates.begin();
                    it != _goalPredicates.end(); it++) {
                current.setBooleanPredicate(it->first, targetName, it->second);
            }

        }
    }

};

<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: detfunc.hxx,v $
 *
 *  $Revision: 1.6 $
 *
 *  last change: $Author: nn $ $Date: 2002-05-08 14:51:43 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#ifndef SC_DETFUNC_HXX
#define SC_DETFUNC_HXX

#ifndef _GEN_HXX //autogen
#include <tools/gen.hxx>
#endif

#ifndef _TOOLS_COLOR_HXX
#include <tools/color.hxx>
#endif

class SdrObject;
class SdrPage;
class String;

class ScCommentData;
class ScDetectiveData;
class ScDocument;
class ScTripel;
class ScAddress;
class ScRange;

#define SC_DET_MAXCIRCLE    1000

enum ScDetectiveDelete { SC_DET_ALL, SC_DET_DETECTIVE, SC_DET_CIRCLES, SC_DET_COMMENTS, SC_DET_ARROWS };

enum ScDetectiveObjType
{
    SC_DETOBJ_NONE,
    SC_DETOBJ_ARROW,
    SC_DETOBJ_FROMOTHERTAB,
    SC_DETOBJ_TOOTHERTAB,
    SC_DETOBJ_CIRCLE
};

class ScDetectiveFunc
{
    static ColorData nArrowColor;
    static ColorData nErrorColor;
    static ColorData nCommentColor;
    static BOOL      bColorsInitialized;

    ScDocument*     pDoc;
    USHORT          nTab;

    Point       GetDrawPos( USHORT nCol, USHORT nRow, BOOL bArrow );
    BOOL        HasArrow( USHORT nStartCol, USHORT nStartRow, USHORT nStartTab,
                            USHORT nEndCol, USHORT nEndRow, USHORT nEndTab );

    void        DeleteArrowsAt( USHORT nCol, USHORT nRow, BOOL bDestPnt );
    void        DeleteBox( USHORT nCol1, USHORT nRow1, USHORT nCol2, USHORT nRow2 );

    BOOL        HasError( const ScTripel& rStart, const ScTripel& rEnd, ScTripel& rErrPos );

    void        FillAttributes( ScDetectiveData& rData );

                // called from DrawEntry/DrawAlienEntry and InsertObject
    BOOL        InsertArrow( USHORT nCol, USHORT nRow,
                                USHORT nRefStartCol, USHORT nRefStartRow,
                                USHORT nRefEndCol, USHORT nRefEndRow,
                                BOOL bFromOtherTab, BOOL bRed,
                                ScDetectiveData& rData );
    BOOL        InsertToOtherTab( USHORT nStartCol, USHORT nStartRow,
                                USHORT nEndCol, USHORT nEndRow, BOOL bRed,
                                ScDetectiveData& rData );

                // DrawEntry / DrawAlienEntry check for existing arrows and errors
    BOOL        DrawEntry( USHORT nCol, USHORT nRow, const ScTripel& rRefStart, const ScTripel& rRefEnd,
                                ScDetectiveData& rData );
    BOOL        DrawAlienEntry( const ScTripel& rRefStart, const ScTripel& rRefEnd,
                                ScDetectiveData& rData );

    void        DrawCircle( USHORT nCol, USHORT nRow, ScDetectiveData& rData );

    SdrObject*  DrawCaption( USHORT nCol, USHORT nRow, const String& rText,
                                ScCommentData& rData, SdrPage* pDestPage,
                                BOOL bHasUserText, BOOL bLeft,
                                const Rectangle& rVisible );

    USHORT      InsertPredLevel( USHORT nCol, USHORT nRow, ScDetectiveData& rData, USHORT nLevel );
    USHORT      InsertPredLevelArea( const ScTripel& rRefStart, const ScTripel& rRefEnd,
                                        ScDetectiveData& rData, USHORT nLevel );
    USHORT      FindPredLevel( USHORT nCol, USHORT nRow, USHORT nLevel, USHORT nDeleteLevel );
    USHORT      FindPredLevelArea( const ScTripel& rRefStart, const ScTripel& rRefEnd,
                                    USHORT nLevel, USHORT nDeleteLevel );

    USHORT      InsertErrorLevel( USHORT nCol, USHORT nRow, ScDetectiveData& rData, USHORT nLevel );

    USHORT      InsertSuccLevel( USHORT nCol1, USHORT nRow1, USHORT nCol2, USHORT nRow2,
                                        ScDetectiveData& rData, USHORT nLevel );
    USHORT      FindSuccLevel( USHORT nCol1, USHORT nRow1, USHORT nCol2, USHORT nRow2,
                                USHORT nLevel, USHORT nDeleteLevel );

    BOOL        FindFrameForObject( SdrObject* pObject, ScRange& rRange );

public:
                ScDetectiveFunc(ScDocument* pDocument, USHORT nTable) : pDoc(pDocument),nTab(nTable) {}

    BOOL        ShowSucc( USHORT nCol, USHORT nRow );
    BOOL        ShowPred( USHORT nCol, USHORT nRow );
    BOOL        ShowError( USHORT nCol, USHORT nRow );

    BOOL        DeleteSucc( USHORT nCol, USHORT nRow );
    BOOL        DeletePred( USHORT nCol, USHORT nRow );
    BOOL        DeleteAll( ScDetectiveDelete eWhat );

    BOOL        MarkInvalid(BOOL& rOverflow);

    SdrObject*  ShowComment( USHORT nCol, USHORT nRow, BOOL bForce, SdrPage* pDestPage = NULL );
    SdrObject*  ShowCommentUser( USHORT nCol, USHORT nRow, const String& rUserText,
                                    const Rectangle& rVisible, BOOL bLeft,
                                    BOOL bForce, SdrPage* pDestPage );
    BOOL        HideComment( USHORT nCol, USHORT nRow );

    void        UpdateAllComments();        // on all tables
    void        UpdateAllArrowColors();     // on all tables

    static BOOL IsNonAlienArrow( SdrObject* pObject );

    ScDetectiveObjType GetDetectiveObjectType( SdrObject* pObject,
                                ScAddress& rPosition, ScRange& rSource, BOOL& rRedLine );
    void        InsertObject( ScDetectiveObjType eType, const ScAddress& rPosition,
                                const ScRange& rSource, BOOL bRedLine );

    static ColorData GetArrowColor();
    static ColorData GetErrorColor();
    static ColorData GetCommentColor();
    static void InitializeColors();
    static BOOL IsColorsInitialized();
};

#endif
<commit_msg>INTEGRATION: CWS rowlimit (1.6.310); FILE MERGED 2004/02/04 11:26:25 er 1.6.310.2: #i1967# replace ScTripel,ScRefTripel with ScAddress,ScRefAddress; get rid of some warnings 2004/01/12 17:14:56 er 1.6.310.1: #i1967# SCCOL,SCROW,SCTAB replace USHORT; SCsCOL,SCsROW,SCsTAB replace short<commit_after>/*************************************************************************
 *
 *  $RCSfile: detfunc.hxx,v $
 *
 *  $Revision: 1.7 $
 *
 *  last change: $Author: obo $ $Date: 2004-06-04 10:06:55 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#ifndef SC_DETFUNC_HXX
#define SC_DETFUNC_HXX

#ifndef SC_ADDRESS_HXX
#include "address.hxx"
#endif

#ifndef _GEN_HXX //autogen
#include <tools/gen.hxx>
#endif

#ifndef _TOOLS_COLOR_HXX
#include <tools/color.hxx>
#endif

class SdrObject;
class SdrPage;
class String;

class ScCommentData;
class ScDetectiveData;
class ScDocument;
class ScAddress;
class ScRange;

#define SC_DET_MAXCIRCLE    1000

enum ScDetectiveDelete { SC_DET_ALL, SC_DET_DETECTIVE, SC_DET_CIRCLES, SC_DET_COMMENTS, SC_DET_ARROWS };

enum ScDetectiveObjType
{
    SC_DETOBJ_NONE,
    SC_DETOBJ_ARROW,
    SC_DETOBJ_FROMOTHERTAB,
    SC_DETOBJ_TOOTHERTAB,
    SC_DETOBJ_CIRCLE
};

class ScDetectiveFunc
{
    static ColorData nArrowColor;
    static ColorData nErrorColor;
    static ColorData nCommentColor;
    static BOOL      bColorsInitialized;

    ScDocument*     pDoc;
    SCTAB           nTab;

    Point       GetDrawPos( SCCOL nCol, SCROW nRow, BOOL bArrow );
    BOOL        HasArrow( const ScAddress& rStart,
                            SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab );

    void        DeleteArrowsAt( SCCOL nCol, SCROW nRow, BOOL bDestPnt );
    void        DeleteBox( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );

    BOOL        HasError( const ScRange& rRange, ScAddress& rErrPos );

    void        FillAttributes( ScDetectiveData& rData );

                // called from DrawEntry/DrawAlienEntry and InsertObject
    BOOL        InsertArrow( SCCOL nCol, SCROW nRow,
                                SCCOL nRefStartCol, SCROW nRefStartRow,
                                SCCOL nRefEndCol, SCROW nRefEndRow,
                                BOOL bFromOtherTab, BOOL bRed,
                                ScDetectiveData& rData );
    BOOL        InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
                                SCCOL nEndCol, SCROW nEndRow, BOOL bRed,
                                ScDetectiveData& rData );

                // DrawEntry / DrawAlienEntry check for existing arrows and errors
    BOOL        DrawEntry( SCCOL nCol, SCROW nRow, const ScRange& rRef,
                                ScDetectiveData& rData );
    BOOL        DrawAlienEntry( const ScRange& rRef,
                                ScDetectiveData& rData );

    void        DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData );

    SdrObject*  DrawCaption( SCCOL nCol, SCROW nRow, const String& rText,
                                ScCommentData& rData, SdrPage* pDestPage,
                                BOOL bHasUserText, BOOL bLeft,
                                const Rectangle& rVisible );

    USHORT      InsertPredLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, USHORT nLevel );
    USHORT      InsertPredLevelArea( const ScRange& rRef,
                                        ScDetectiveData& rData, USHORT nLevel );
    USHORT      FindPredLevel( SCCOL nCol, SCROW nRow, USHORT nLevel, USHORT nDeleteLevel );
    USHORT      FindPredLevelArea( const ScRange& rRef,
                                    USHORT nLevel, USHORT nDeleteLevel );

    USHORT      InsertErrorLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, USHORT nLevel );

    USHORT      InsertSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                                        ScDetectiveData& rData, USHORT nLevel );
    USHORT      FindSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                                USHORT nLevel, USHORT nDeleteLevel );

    BOOL        FindFrameForObject( SdrObject* pObject, ScRange& rRange );

public:
                ScDetectiveFunc(ScDocument* pDocument, SCTAB nTable) : pDoc(pDocument),nTab(nTable) {}

    BOOL        ShowSucc( SCCOL nCol, SCROW nRow );
    BOOL        ShowPred( SCCOL nCol, SCROW nRow );
    BOOL        ShowError( SCCOL nCol, SCROW nRow );

    BOOL        DeleteSucc( SCCOL nCol, SCROW nRow );
    BOOL        DeletePred( SCCOL nCol, SCROW nRow );
    BOOL        DeleteAll( ScDetectiveDelete eWhat );

    BOOL        MarkInvalid(BOOL& rOverflow);

    SdrObject*  ShowComment( SCCOL nCol, SCROW nRow, BOOL bForce, SdrPage* pDestPage = NULL );
    SdrObject*  ShowCommentUser( SCCOL nCol, SCROW nRow, const String& rUserText,
                                    const Rectangle& rVisible, BOOL bLeft,
                                    BOOL bForce, SdrPage* pDestPage );
    BOOL        HideComment( SCCOL nCol, SCROW nRow );

    void        UpdateAllComments();        // on all tables
    void        UpdateAllArrowColors();     // on all tables

    static BOOL IsNonAlienArrow( SdrObject* pObject );

    ScDetectiveObjType GetDetectiveObjectType( SdrObject* pObject,
                                ScAddress& rPosition, ScRange& rSource, BOOL& rRedLine );
    void        InsertObject( ScDetectiveObjType eType, const ScAddress& rPosition,
                                const ScRange& rSource, BOOL bRedLine );

    static ColorData GetArrowColor();
    static ColorData GetErrorColor();
    static ColorData GetCommentColor();
    static void InitializeColors();
    static BOOL IsColorsInitialized();
};

#endif
<|endoftext|>


<commit_before>#ifndef HUMLConfig_HPP
#define HUMLConfig_HPP

#include <string>
#include <cstring>
#include <cstdlib>
#include <stdexcept>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <list>
#include <vector>
#include <cmath>
#include <boost/smart_ptr.hpp>
#include <boost/numeric/ublas/storage.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/format.hpp>
#include <fstream>
#include <eigen3/Eigen/Dense>

#include "../config/config.hpp"
#include "object.hpp"

/** version of the library */
#define HUML_VERSION_MAJOR 2
#define HUML_VERSION_MINOR 0

//definition of the macro ASSERT
#ifndef DEBUG
    #define ASSERT(x)
#else
    #define ASSERT(x) \
             if (! (x)) \
            { \
               cout << "ERROR!! Assert " << #x << " failed\n"; \
               cout << " on line " << __LINE__  << "\n"; \
               cout << " in file " << __FILE__ << "\n";  \
            }
#endif

using namespace std;
using namespace Eigen;

/** This is the main namespace of the library */
namespace HUMotion{

typedef boost::shared_ptr<Object> objectPtr;/**< shared pointer to an object in the scenario */

const double PHI = (-log(2.0)/log(TB));/**< parameter to control when the bounce posture is reached */
const double AP = 15.0*static_cast<double>(M_PI)/180; /**< aperture of the fingers when approaching to pick */

const int N_STEP_MIN = 5; // minimum number of steps
const int N_STEP_MAX = 100; // maximum number of steps

/** this struct defines the Denavit-Hartenberg kinematic parameters */
typedef struct{
    vector<double> d; /**< distances between consecutive frames along the y axes in [mm] */
    vector<double> a; /**< distances between concecutive frames along the z axes in [mm] */
    vector<double> alpha; /**< angle around the x axes between consecutive z axes in [rad] */
    vector<double> theta; /**< angle around the z axes between consecutive x axes in [rad] */
} DHparameters;

/** this struct defines the barrett hand */
typedef struct{
    double maxAperture; /**< [mm] max aperture of the hand in [mm] */
    double Aw; /**< smallest distance between F1 and F2 in [mm] */
    double A1; /**< length of the 1st part of the finger in [mm] */
    double A2; /**< length of the first phalax in [mm] */
    double A3; /**< length of the second phalax in [mm] */
    double D3; /**< depth of the fingertip in [mm] */
    double phi2; /**< angular displacement between the 1st part of the finger and the 1st phalax in [rad] */
    double phi3; /**< angular displacement between the 1st and the 2nd phalax in [rad] */
    vector<int> rk; /**< r parameters of the barrett hand */
    vector<int> jk; /**< j parameters of the barrett hand */
} BarrettHand;

/** this struct defines a human finger */
typedef struct{
    double ux; /**<  position of the finger with respect to the center of the palm along the x axis in [mm] */
    double uy; /**<  position of the finger with respect to the center of the palm along the y axis in [mm] */
    double uz; /**<  position of the finger with respect to the center of the palm along the z axis in [mm] */
    DHparameters finger_specs; /**< the Denavit-Hartenberg parameters of the finger */
} HumanFinger;

/** this struct defines a human thumb */
typedef struct{
    double uTx; /**<  position of the thumb with respect to the center of the palm along the x axis in [mm] */
    double uTy; /**<  position of the thumb with respect to the center of the palm along the y axis in [mm] */
    double uTz; /**<  position of the thumb with respect to the center of the palm along the z axis in [mm] */
    DHparameters thumb_specs; /**< the Denavit-Hartenberg parameters of the thumb */
} HumanThumb;

/** this struct defines a human hand */
typedef struct{
  vector<HumanFinger> fingers; /**< fingers of the hand */
  HumanThumb thumb; /**<  thumb of the hand */
  double maxAperture; /**< max aperture of the hand in [mm] */
} HumanHand;

/** this struct defines the parameters of the movement */
typedef struct{
    int arm_code; /**< the code of the arm: 0 = both arms, 1 = right arm, 2 = left arm */
    int hand_code;/**< the code of the hand: 0 = human hand, 1 = barrett hand */
    int griptype; /**< the type of the grip */
    string mov_infoline; /**< description of the movement */
    double dHO;/**< distanche hand-target*/
    std::vector<double> finalHand;/**< final posture of the hand */
    std::vector<double> target;/**< target / location to reach: target(0)=x, target(1)=y, target(2)=z, target(3)=roll, target(4)=pitch, target(6)=yaw,*/
    objectPtr obj; /**< object involved in the movement. The info of the object have to be updated according to the selected movement */
    bool approach;/**< true to use the approach options, false otherwise  */
    bool retreat;/**< true to use the retreat options, false otherwise */
    std::vector<double> pre_grasp_approach; /**< (0)= x component, (1)= y component, (2)= z component, (3)= distance form the target*/
    std::vector<double> post_grasp_retreat; /**< (0)= x component, (1)= y component, (2)= z component, (3)= distance form the target*/
    std::vector<double> pre_place_approach; /**< (0)= x component, (1)= y component, (2)= z component, (3)= distance form the target*/
    std::vector<double> post_place_retreat; /**< (0)= x component, (1)= y component, (2)= z component, (3)= distance form the target*/
    bool rand_init; /**< true to select randon initialization in "plan" stages */
    bool use_move_plane; /**< true to constrain the end-effector to move on a plane in move movements, false otherwise*/
    std::vector<double> plane_params; /**< plane cartesian parameters in move movements: a*x+b*y+c*z+d=0. a=plane_params(0), b=plane_params(1), c=plane_params(2), d=plane_params(3) */
}mov_params;
/** this struct defines the boundary conditions of the movement*/
typedef struct{
    vector<double> vel_0; /**< initial velocity of the joints in [rad/s] */
    vector<double> vel_f; /**< final velocity of the joints in [rad/s] */
    vector<double> acc_0; /**< initial acceleration of the joints in [rad/s²] */
    vector<double> acc_f; /**< final acceleration of the joints in [rad/s²] */
} boundaryConditions;

/** this struct defines the tolerances that have to be set before planning the trajectory*/
typedef struct{
    mov_params mov_specs; /**< specifications of the movement */
    vector<double> tolsArm; /**< radius of the spheres along the arm in [mm] */
    MatrixXd tolsHand; /**< radius of the spheres along the fingers in [mm] */
    MatrixXd final_tolsObstacles; /**< tolerances of the final posture against the obstacles in [mm] */
    vector< MatrixXd > singleArm_tolsTarget; /**< tolerances of the trajectory against the target in [mm] */
    vector< MatrixXd > singleArm_tolsObstacles; /**< tolerances of the trajectory against the obstacles in [mm] */
    double tolTarPos; /**< tolerance of the final position of the hand against the target in [mm] */
    double tolTarOr; /**< tolerance of the final orientation of the hand against the target in [mm] */
    boundaryConditions bounds; /**< boundary condistions of the bounce problem */
    vector<double> vel_approach; /**< velocity of the joints in [rad/s] at the beginning of the approach stage */
    vector<double> acc_approach; /**< acceleration of the joints in [rad/s²] at the beginning of the approach stage */
    vector<double> lambda_final; /**< weights for the final posture optimization */
    vector<double> lambda_bounce; /**< weights for the bounce posture optimization */
    vector<double> w_max; /**< maximum angular velocity for each joint [rad/s] */
    bool obstacle_avoidance; /**< true to avoid obstacle */
    bool target_avoidance; /**< true to avoid the target during the motion */
} huml_params;

/** This struct defines the result of the planned trajectory */
typedef struct{
    int mov_type;/**< type of the planned movement */
    int status;/**< status code of the planning */
    string status_msg;/**< status message of the planning */
    string object_id;/**< identity of the object involved in the movement */
    vector<MatrixXd> trajectory_stages;/**< sequence of the trajectories */
    vector<MatrixXd> velocity_stages;/**< sequence of the velocities */
    vector<MatrixXd> acceleration_stages;/**< sequence of the accelerations */
    vector<double> time_steps; /**< sequence of each time steps for each trajectory */
    vector<string> trajectory_descriptions;/**< description of the trajectories */
}planning_result;

} // namespace HUMotion

#endif // HUMLConfig_HPP
<commit_msg>minor changes<commit_after>#ifndef HUMLConfig_HPP
#define HUMLConfig_HPP

#include <string>
#include <cstring>
#include <cstdlib>
#include <stdexcept>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <list>
#include <vector>
#include <cmath>
#include <boost/smart_ptr.hpp>
#include <boost/numeric/ublas/storage.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/format.hpp>
#include <fstream>
#include <eigen3/Eigen/Dense>

#include "../config/config.hpp"
#include "object.hpp"

/** version of the library */
#define HUML_VERSION_MAJOR 2
#define HUML_VERSION_MINOR 0

//definition of the macro ASSERT
#ifndef DEBUG
    #define ASSERT(x)
#else
    #define ASSERT(x) \
             if (! (x)) \
            { \
               cout << "ERROR!! Assert " << #x << " failed\n"; \
               cout << " on line " << __LINE__  << "\n"; \
               cout << " in file " << __FILE__ << "\n";  \
            }
#endif

using namespace std;
using namespace Eigen;

/** This is the main namespace of the library */
namespace HUMotion{

typedef boost::shared_ptr<Object> objectPtr;/**< shared pointer to an object in the scenario */

const double PHI = (-log(2.0)/log(TB));/**< parameter to control when the bounce posture is reached */
const double AP = 15.0*static_cast<double>(M_PI)/180; /**< aperture of the fingers when approaching to pick */

const int N_STEP_MIN = 5; // minimum number of steps
const int N_STEP_MAX = 50; // maximum number of steps

/** this struct defines the Denavit-Hartenberg kinematic parameters */
typedef struct{
    vector<double> d; /**< distances between consecutive frames along the y axes in [mm] */
    vector<double> a; /**< distances between concecutive frames along the z axes in [mm] */
    vector<double> alpha; /**< angle around the x axes between consecutive z axes in [rad] */
    vector<double> theta; /**< angle around the z axes between consecutive x axes in [rad] */
} DHparameters;

/** this struct defines the barrett hand */
typedef struct{
    double maxAperture; /**< [mm] max aperture of the hand in [mm] */
    double Aw; /**< smallest distance between F1 and F2 in [mm] */
    double A1; /**< length of the 1st part of the finger in [mm] */
    double A2; /**< length of the first phalax in [mm] */
    double A3; /**< length of the second phalax in [mm] */
    double D3; /**< depth of the fingertip in [mm] */
    double phi2; /**< angular displacement between the 1st part of the finger and the 1st phalax in [rad] */
    double phi3; /**< angular displacement between the 1st and the 2nd phalax in [rad] */
    vector<int> rk; /**< r parameters of the barrett hand */
    vector<int> jk; /**< j parameters of the barrett hand */
} BarrettHand;

/** this struct defines a human finger */
typedef struct{
    double ux; /**<  position of the finger with respect to the center of the palm along the x axis in [mm] */
    double uy; /**<  position of the finger with respect to the center of the palm along the y axis in [mm] */
    double uz; /**<  position of the finger with respect to the center of the palm along the z axis in [mm] */
    DHparameters finger_specs; /**< the Denavit-Hartenberg parameters of the finger */
} HumanFinger;

/** this struct defines a human thumb */
typedef struct{
    double uTx; /**<  position of the thumb with respect to the center of the palm along the x axis in [mm] */
    double uTy; /**<  position of the thumb with respect to the center of the palm along the y axis in [mm] */
    double uTz; /**<  position of the thumb with respect to the center of the palm along the z axis in [mm] */
    DHparameters thumb_specs; /**< the Denavit-Hartenberg parameters of the thumb */
} HumanThumb;

/** this struct defines a human hand */
typedef struct{
  vector<HumanFinger> fingers; /**< fingers of the hand */
  HumanThumb thumb; /**<  thumb of the hand */
  double maxAperture; /**< max aperture of the hand in [mm] */
} HumanHand;

/** this struct defines the parameters of the movement */
typedef struct{
    int arm_code; /**< the code of the arm: 0 = both arms, 1 = right arm, 2 = left arm */
    int hand_code;/**< the code of the hand: 0 = human hand, 1 = barrett hand */
    int griptype; /**< the type of the grip */
    string mov_infoline; /**< description of the movement */
    double dHO;/**< distanche hand-target*/
    std::vector<double> finalHand;/**< final posture of the hand */
    std::vector<double> target;/**< target / location to reach: target(0)=x, target(1)=y, target(2)=z, target(3)=roll, target(4)=pitch, target(6)=yaw,*/
    objectPtr obj; /**< object involved in the movement. The info of the object have to be updated according to the selected movement */
    bool approach;/**< true to use the approach options, false otherwise  */
    bool retreat;/**< true to use the retreat options, false otherwise */
    std::vector<double> pre_grasp_approach; /**< (0)= x component, (1)= y component, (2)= z component, (3)= distance form the target*/
    std::vector<double> post_grasp_retreat; /**< (0)= x component, (1)= y component, (2)= z component, (3)= distance form the target*/
    std::vector<double> pre_place_approach; /**< (0)= x component, (1)= y component, (2)= z component, (3)= distance form the target*/
    std::vector<double> post_place_retreat; /**< (0)= x component, (1)= y component, (2)= z component, (3)= distance form the target*/
    bool rand_init; /**< true to select randon initialization in "plan" stages */
    bool use_move_plane; /**< true to constrain the end-effector to move on a plane in move movements, false otherwise*/
    std::vector<double> plane_params; /**< plane cartesian parameters in move movements: a*x+b*y+c*z+d=0. a=plane_params(0), b=plane_params(1), c=plane_params(2), d=plane_params(3) */
}mov_params;
/** this struct defines the boundary conditions of the movement*/
typedef struct{
    vector<double> vel_0; /**< initial velocity of the joints in [rad/s] */
    vector<double> vel_f; /**< final velocity of the joints in [rad/s] */
    vector<double> acc_0; /**< initial acceleration of the joints in [rad/s²] */
    vector<double> acc_f; /**< final acceleration of the joints in [rad/s²] */
} boundaryConditions;

/** this struct defines the tolerances that have to be set before planning the trajectory*/
typedef struct{
    mov_params mov_specs; /**< specifications of the movement */
    vector<double> tolsArm; /**< radius of the spheres along the arm in [mm] */
    MatrixXd tolsHand; /**< radius of the spheres along the fingers in [mm] */
    MatrixXd final_tolsObstacles; /**< tolerances of the final posture against the obstacles in [mm] */
    vector< MatrixXd > singleArm_tolsTarget; /**< tolerances of the trajectory against the target in [mm] */
    vector< MatrixXd > singleArm_tolsObstacles; /**< tolerances of the trajectory against the obstacles in [mm] */
    double tolTarPos; /**< tolerance of the final position of the hand against the target in [mm] */
    double tolTarOr; /**< tolerance of the final orientation of the hand against the target in [mm] */
    boundaryConditions bounds; /**< boundary condistions of the bounce problem */
    vector<double> vel_approach; /**< velocity of the joints in [rad/s] at the beginning of the approach stage */
    vector<double> acc_approach; /**< acceleration of the joints in [rad/s²] at the beginning of the approach stage */
    vector<double> lambda_final; /**< weights for the final posture optimization */
    vector<double> lambda_bounce; /**< weights for the bounce posture optimization */
    vector<double> w_max; /**< maximum angular velocity for each joint [rad/s] */
    bool obstacle_avoidance; /**< true to avoid obstacle */
    bool target_avoidance; /**< true to avoid the target during the motion */
} huml_params;

/** This struct defines the result of the planned trajectory */
typedef struct{
    int mov_type;/**< type of the planned movement */
    int status;/**< status code of the planning */
    string status_msg;/**< status message of the planning */
    string object_id;/**< identity of the object involved in the movement */
    vector<MatrixXd> trajectory_stages;/**< sequence of the trajectories */
    vector<MatrixXd> velocity_stages;/**< sequence of the velocities */
    vector<MatrixXd> acceleration_stages;/**< sequence of the accelerations */
    vector<double> time_steps; /**< sequence of each time steps for each trajectory */
    vector<string> trajectory_descriptions;/**< description of the trajectories */
}planning_result;

} // namespace HUMotion

#endif // HUMLConfig_HPP
<|endoftext|>


<commit_before>/* ux++ - ux implementation for C++ */

/* LICENSE - The MIT License (MIT)

Copyright (c) 2013 Tomona Nanase

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#ifndef HANDLETYPE_HPP
#define	HANDLETYPE_HPP

namespace uxpp {

  /**
   * 内部で扱われるハンドルのタイプを表す列挙体です。
   */
  enum class HandleType {
    /**
     * ゼロのゲートを持ち、発音されないノートを表します。
     */
    zeroGate = 0,

    /**
     * パートまたはマスターの各パラメータをリセットします。
     */
    reset = 1,

    /**
     * ノートのエンベロープをサイレンス状態に移行させ、無音状態にします。
     */
    silence = 2,

    /**
     * ノートのエンベロープをリリース状態に移行させます。
     */
    noteOff = 3,

    /**
     * ボリューム (音量) を変更します。
     */
    volume = 4,

    /**
     * パンポット (定位) を変更します。
     */
    panpot = 5,

    /**
     * ビブラートに関するパラメータを設定します。
     */
    vibrate = 6,

    /**
     * パートに波形を割り当てます。
     */
    waveform = 7,

    /**
     * 波形のパラメータを編集します。
     */
    editWaveform = 8,

    /**
     * パートの音量エンベロープを変更します。
     */
    envelope = 9,

    /**
     * パートのファインチューン値を変更します。
     */
    fineTune = 10,

    /**
     * パートの発音ノートキーをシフトします。
     */
    keyShift = 11,

    /**
     * ポルタメント効果に関するパラメータを設定します。
     */
    portament = 12,

    /**
     * パートを指定されたノートまたは周波数でアタック状態にします。
     */
    noteOn = 13,
  };

  const std::unordered_map<std::string, HandleType>
          HandleTypeString = {
    {"zeroGate", HandleType::zeroGate},
    {"reset", HandleType::reset},
    {"silence", HandleType::silence},
    {"noteOff", HandleType::noteOff},
    {"volume", HandleType::volume},
    {"panpot", HandleType::panpot},
    {"vibrate", HandleType::vibrate},
    {"waveform", HandleType::waveform},
    {"editWaveform", HandleType::editWaveform},
    {"envelope", HandleType::envelope},
    {"fineTune", HandleType::fineTune},
    {"keyShift", HandleType::keyShift},
    {"portament", HandleType::portament},
    {"noteOn", HandleType::noteOn},
  };
}

#endif	/* HANDLETYPE_HPP */

<commit_msg>HandleType列挙体を改良<commit_after>/* ux++ - ux implementation for C++ */

/* LICENSE - The MIT License (MIT)

Copyright (c) 2013 Tomona Nanase

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#ifndef HANDLETYPE_HPP
#define	HANDLETYPE_HPP

#include <unordered_map>
#include <string>
#include "EnumBase.hpp"

using namespace std;

namespace uxpp {

  /**
   * 内部で扱われるハンドルのタイプを表す列挙体です。
   */
  class HandleType : public EnumBase {
  public:

    // <editor-fold desc="-- Enums --">

    enum values {
      /**
       * ゼロのゲートを持ち、発音されないノートを表します。
       */
      zeroGate = 0,

      /**
       * パートまたはマスターの各パラメータをリセットします。
       */
      reset = 1,

      /**
       * ノートのエンベロープをサイレンス状態に移行させ、無音状態にします。
       */
      silence = 2,

      /**
       * ノートのエンベロープをリリース状態に移行させます。
       */
      noteOff = 3,

      /**
       * ボリューム (音量) を変更します。
       */
      volume = 4,

      /**
       * パンポット (定位) を変更します。
       */
      panpot = 5,

      /**
       * ビブラートに関するパラメータを設定します。
       */
      vibrate = 6,

      /**
       * パートに波形を割り当てます。
       */
      waveform = 7,

      /**
       * 波形のパラメータを編集します。
       */
      editWaveform = 8,

      /**
       * パートの音量エンベロープを変更します。
       */
      envelope = 9,

      /**
       * パートのファインチューン値を変更します。
       */
      fineTune = 10,

      /**
       * パートの発音ノートキーをシフトします。
       */
      keyShift = 11,

      /**
       * ポルタメント効果に関するパラメータを設定します。
       */
      portament = 12,

      /**
       * パートを指定されたノートまたは周波数でアタック状態にします。
       */
      noteOn = 13,
    };

    // </editor-fold>

    // <editor-fold desc="-- Methods --">

    _key_exists_impl(HandleType);
    _value_exists_impl(HandleType);
    _toString_impl(HandleType);
    _tryParse_impl(HandleType);
    // </editor-fold>

  private:
    static const unordered_map<string, values> map;
  };

  const unordered_map<string, HandleType::values>
          HandleType::map = {
    {"zeroGate", zeroGate},
    {"reset", reset},
    {"silence", silence},
    {"noteOff", noteOff},
    {"volume", volume},
    {"panpot", panpot},
    {"vibrate", vibrate},
    {"waveform", waveform},
    {"editWaveform", editWaveform},
    {"envelope", envelope},
    {"fineTune", fineTune},
    {"keyShift", keyShift},
    {"portament", portament},
    {"noteOn", noteOn},
  };
}

#endif	/* HANDLETYPE_HPP */

<|endoftext|>


<commit_before>/// @file
/// @version 2.0
///
/// @section LICENSE
///
/// This program is free software; you can redistribute it and/or modify it under
/// the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause

#include "Manager.h"
#include "Mutex.h"
#include "WorkerThread.h"
#include "VideoClip.h"

namespace theoraplayer
{
#ifdef _THREAD_NAMING
	static int threadCounter = 1;
	static theoraplayer::Mutex counterMutex;
#endif

	WorkerThread::WorkerThread() : Thread(&WorkerThread::_work)
	{
		this->clip = NULL;
	}

	WorkerThread::~WorkerThread()
	{
	}

	void WorkerThread::_work(Thread* thread)
	{
		WorkerThread* self = (WorkerThread*)thread;
		Mutex::ScopeLock lock;
#ifdef _THREAD_NAMING
		{
			lock.acquire(&counterMutex);
			char name[64] = { 0 };
			sprintf(name, "WorkerThread %d", threadCounter++);
			pthread_setname_np(name);
			lock.release();
		}
#endif
		bool decoded = false;
		while (self->executing && self->isRunning())
		{
			self->clip = theoraplayer::manager->_requestWork(self);
			if (self->clip == NULL)
			{
				if (!self->executing || !self->isRunning()) // don't pause if a destruction was given
				{
					break;
				}
				Thread::sleep(100.0f);
				continue;
			}
			lock.acquire(self->clip->threadAccessMutex);
			// if user requested seeking, do that then.
			if (self->clip->seekFrame >= 0)
			{
				self->clip->_executeSeek();
			}
			decoded = self->clip->_decodeNextFrame();
			// TODOth - this is a potential hazard as assignedWorkerThread is set under a VideoManager::workMutex lock, but accessed here under a VideoClip::threadAccessMutex lock
			if (self->clip->assignedWorkerThread == self)
			{
				self->clip->assignedWorkerThread = NULL;
				self->clip = NULL;
			}
			lock.release();
			if (!decoded)
			{
				Thread::sleep(1.0f); // this happens when the video frame queue is full.
			}
		}
	}

}<commit_msg>- small Apple fix<commit_after>/// @file
/// @version 2.0
///
/// @section LICENSE
///
/// This program is free software; you can redistribute it and/or modify it under
/// the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause

#ifndef _WIN32
#include <unistd.h>
#include <pthread.h>
#endif

#include "Manager.h"
#include "Mutex.h"
#include "WorkerThread.h"
#include "VideoClip.h"

namespace theoraplayer
{
#ifdef _THREAD_NAMING
	static int threadCounter = 1;
	static theoraplayer::Mutex counterMutex;
#endif

	WorkerThread::WorkerThread() : Thread(&WorkerThread::_work)
	{
		this->clip = NULL;
	}

	WorkerThread::~WorkerThread()
	{
	}

	void WorkerThread::_work(Thread* thread)
	{
		WorkerThread* self = (WorkerThread*)thread;
		Mutex::ScopeLock lock;
#ifdef _THREAD_NAMING
		{
			lock.acquire(&counterMutex);
			char name[64] = { 0 };
			sprintf(name, "WorkerThread %d", threadCounter++);
			pthread_setname_np(name);
			lock.release();
		}
#endif
		bool decoded = false;
		while (self->executing && self->isRunning())
		{
			self->clip = theoraplayer::manager->_requestWork(self);
			if (self->clip == NULL)
			{
				if (!self->executing || !self->isRunning()) // don't pause if a destruction was given
				{
					break;
				}
				Thread::sleep(100.0f);
				continue;
			}
			lock.acquire(self->clip->threadAccessMutex);
			// if user requested seeking, do that then.
			if (self->clip->seekFrame >= 0)
			{
				self->clip->_executeSeek();
			}
			decoded = self->clip->_decodeNextFrame();
			// TODOth - this is a potential hazard as assignedWorkerThread is set under a VideoManager::workMutex lock, but accessed here under a VideoClip::threadAccessMutex lock
			if (self->clip->assignedWorkerThread == self)
			{
				self->clip->assignedWorkerThread = NULL;
				self->clip = NULL;
			}
			lock.release();
			if (!decoded)
			{
				Thread::sleep(1.0f); // this happens when the video frame queue is full.
			}
		}
	}

}<|endoftext|>


<commit_before>//----------------------------------------------------------------------
//    $Id$
//    Version: $Name$
//
//    Copyright (C) 2010, 2011, 2012 by the deal.II authors
//
//    This file is subject to QPL and may not be  distributed
//    without copyright and license information. Please refer
//    to the file deal.II/doc/license.html for the  text  and
//    further information on this license.
//
//----------------------------------------------------------------------

#include <deal.II/base/config.h>

#include <iostream>

#ifdef HAVE_LIBUMFPACK
extern "C" {
#include <umfpack.h>
}
#endif

#if defined(DEAL_II_COMPILER_SUPPORTS_MPI)
#include <mpi.h>
#endif

#ifdef DEAL_II_USE_TRILINOS
#  include <Trilinos_version.h>
#endif

#ifdef DEAL_II_USE_MUMPS
#  include <base/utilities.h>
#  include <dmumps_c.h>
#endif

#ifdef DEAL_II_USE_PETSC
#  include <petscversion.h>
#endif

#ifdef DEAL_II_USE_SLEPC
#  include <slepcversion.h>
#endif

int main()
{
#ifdef HAVE_LIBBLAS
  std::cout << "dealii-feature: BLAS=yes" << std::endl;
#endif

#ifdef HAVE_LIBLAPACK
  std::cout << "dealii-feature: LAPACK=yes" << std::endl;
#endif

#ifdef HAVE_LIBUMFPACK
  std::cout << "dealii-feature: UMFPACK="
	    << UMFPACK_MAIN_VERSION << '.'
	    << UMFPACK_SUB_VERSION << '.'
	    << UMFPACK_SUBSUB_VERSION << std::endl;
#endif

#if defined(DEAL_II_COMPILER_SUPPORTS_MPI)
#  ifdef OMPI_MAJOR_VERSION
  std::cout << "dealii-feature: MPI=OpenMPI "
	    << OMPI_MAJOR_VERSION << '.'
	    << OMPI_MINOR_VERSION << '.'
	    << OMPI_RELEASE_VERSION << std::endl;
#  else
  std::cout << "dealii-feature: MPI="
	    << MPI_VERSION << '.'
	    << MPI_SUBVERSION << std::endl;
#  endif
#endif

#ifdef DEAL_II_USE_TRILINOS
#  ifdef TRILINOS_VERSION_STRING
  std::cout << "dealii-feature: Trilinos=" << TRILINOS_VERSION_STRING << std::endl;
#  else
  const unsigned int trilinos_subminor = TRILINOS_MAJOR_MINOR_VERSION % 100;
  const unsigned int trilinos_minor = (TRILINOS_MAJOR_MINOR_VERSION/100) % 100;
  std::cout << "dealii-feature: Trilinos="
	    << TRILINOS_MAJOR_VERSION << '.'
	    << trilinos_minor << '.'
	    << trilinos_subminor << std::endl;
#  endif
#endif

#ifdef DEAL_II_USE_MUMPS
  std::cout << "dealii-feature: MUMPS=yes" << std::endl;
#endif

#ifdef DEAL_II_USE_PETSC
  std::cout << "dealii-feature: PETSc="
	    << PETSC_VERSION_MAJOR << '.'
	    << PETSC_VERSION_MINOR << '.'
	    << PETSC_VERSION_SUBMINOR << "-p"
	    << PETSC_VERSION_PATCH << std::endl;
#endif

#ifdef DEAL_II_USE_SLEPC
  std::cout << "dealii-feature: SLEPc="
	    << SLEPC_VERSION_MAJOR << '.'
	    << SLEPC_VERSION_MINOR << '.'
	    << SLEPC_VERSION_SUBMINOR << "-p"
	    << SLEPC_VERSION_PATCH << std::endl;
#endif

#if defined(HAVE_HSL_MA27) || defined(HAVE_HSL_MA47)
  std::cout << "dealii-feature: HSL=";
#ifdef HAVE_HSL_MA27
  std::cout << "MA27";
#endif
#ifdef HAVE_HSL_MA47
  std::cout << "MA47";
#endif
  std::cout << std::endl;
#endif

#ifdef DEAL_II_USE_P4EST
  std::cout << "dealii-feature: P4est=yes" << std::endl;
#endif

#ifdef DEAL_II_HAVE_HDF5
   std::cout << "dealii-feature: HDF5=yes" << std::endl;
#endif

#ifdef DEAL_II_HAVE_TECPLOT
   std::cout << "dealii-feature: Tecplot=yes" << std::endl;
#endif

#ifdef HAVE_LIBNETCDF
  std::cout << "dealii-feature: NetCDF=yes" << std::endl;
#endif

#ifdef HAVE_LIBZ
  std::cout << "dealii-feature: LibZ=yes" << std::endl;
#endif

#ifdef DEAL_II_DISABLE_PARSER
  std::cout << "dealii-feature: parser=no" << std::endl;
#else
  std::cout << "dealii-feature: parser=yes" << std::endl;
#endif

}
<commit_msg>Change OpenMPI output and add comment<commit_after>//----------------------------------------------------------------------
//    $Id$
//    Version: $Name$
//
//    Copyright (C) 2010, 2011, 2012 by the deal.II authors
//
//    This file is subject to QPL and may not be  distributed
//    without copyright and license information. Please refer
//    to the file deal.II/doc/license.html for the  text  and
//    further information on this license.
//
//----------------------------------------------------------------------

#include <deal.II/base/config.h>

#include <iostream>

#ifdef HAVE_LIBUMFPACK
extern "C" {
#include <umfpack.h>
}
#endif

#if defined(DEAL_II_COMPILER_SUPPORTS_MPI)
#include <mpi.h>
#endif

#ifdef DEAL_II_USE_TRILINOS
#  include <Trilinos_version.h>
#endif

#ifdef DEAL_II_USE_MUMPS
#  include <base/utilities.h>
#  include <dmumps_c.h>
#endif

#ifdef DEAL_II_USE_PETSC
#  include <petscversion.h>
#endif

#ifdef DEAL_II_USE_SLEPC
#  include <slepcversion.h>
#endif

// Output configuration options from config.h.
// The format of each line is
//
// deal-feature: FEATURE=value
//
// no spaces in any token!

int main()
{
#ifdef HAVE_LIBBLAS
  std::cout << "dealii-feature: BLAS=yes" << std::endl;
#endif

#ifdef HAVE_LIBLAPACK
  std::cout << "dealii-feature: LAPACK=yes" << std::endl;
#endif

#ifdef HAVE_LIBUMFPACK
  std::cout << "dealii-feature: UMFPACK="
	    << UMFPACK_MAIN_VERSION << '.'
	    << UMFPACK_SUB_VERSION << '.'
	    << UMFPACK_SUBSUB_VERSION << std::endl;
#endif

#if defined(DEAL_II_COMPILER_SUPPORTS_MPI)
#  ifdef OMPI_MAJOR_VERSION
  std::cout << "dealii-feature: MPI=OpenMPI-"
	    << OMPI_MAJOR_VERSION << '.'
	    << OMPI_MINOR_VERSION << '.'
	    << OMPI_RELEASE_VERSION << std::endl;
#  else
  std::cout << "dealii-feature: MPI="
	    << MPI_VERSION << '.'
	    << MPI_SUBVERSION << std::endl;
#  endif
#endif

#ifdef DEAL_II_USE_TRILINOS
#  ifdef TRILINOS_VERSION_STRING
  std::cout << "dealii-feature: Trilinos=" << TRILINOS_VERSION_STRING << std::endl;
#  else
  const unsigned int trilinos_subminor = TRILINOS_MAJOR_MINOR_VERSION % 100;
  const unsigned int trilinos_minor = (TRILINOS_MAJOR_MINOR_VERSION/100) % 100;
  std::cout << "dealii-feature: Trilinos="
	    << TRILINOS_MAJOR_VERSION << '.'
	    << trilinos_minor << '.'
	    << trilinos_subminor << std::endl;
#  endif
#endif

#ifdef DEAL_II_USE_MUMPS
  std::cout << "dealii-feature: MUMPS=yes" << std::endl;
#endif

#ifdef DEAL_II_USE_PETSC
  std::cout << "dealii-feature: PETSc="
	    << PETSC_VERSION_MAJOR << '.'
	    << PETSC_VERSION_MINOR << '.'
	    << PETSC_VERSION_SUBMINOR << "-p"
	    << PETSC_VERSION_PATCH << std::endl;
#endif

#ifdef DEAL_II_USE_SLEPC
  std::cout << "dealii-feature: SLEPc="
	    << SLEPC_VERSION_MAJOR << '.'
	    << SLEPC_VERSION_MINOR << '.'
	    << SLEPC_VERSION_SUBMINOR << "-p"
	    << SLEPC_VERSION_PATCH << std::endl;
#endif

#if defined(HAVE_HSL_MA27) || defined(HAVE_HSL_MA47)
  std::cout << "dealii-feature: HSL=";
#ifdef HAVE_HSL_MA27
  std::cout << "MA27";
#endif
#ifdef HAVE_HSL_MA47
  std::cout << "MA47";
#endif
  std::cout << std::endl;
#endif

#ifdef DEAL_II_USE_P4EST
  std::cout << "dealii-feature: P4est=yes" << std::endl;
#endif

#ifdef DEAL_II_HAVE_HDF5
   std::cout << "dealii-feature: HDF5=yes" << std::endl;
#endif

#ifdef DEAL_II_HAVE_TECPLOT
   std::cout << "dealii-feature: Tecplot=yes" << std::endl;
#endif

#ifdef HAVE_LIBNETCDF
  std::cout << "dealii-feature: NetCDF=yes" << std::endl;
#endif

#ifdef HAVE_LIBZ
  std::cout << "dealii-feature: LibZ=yes" << std::endl;
#endif

#ifdef DEAL_II_DISABLE_PARSER
  std::cout << "dealii-feature: parser=no" << std::endl;
#else
  std::cout << "dealii-feature: parser=yes" << std::endl;
#endif

}
<|endoftext|>


<commit_before>/**
 * @file
 *
 * @brief Tests for the Backend builder class
 *
 * @copyright BSD License (see doc/COPYING or http://www.libelektra.org)
 *
 */

#define ELEKTRA_PLUGINSPEC_WITH_COMPARE

#include <backend.hpp>
#include <backends.hpp>
#include <plugindatabase.hpp>

#include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>

#include <gtest/gtest.h>
#include <kdb.hpp>

std::vector<std::string> getAllPlugins ()
{
	using namespace kdb;
	using namespace kdb::tools;
	ModulesPluginDatabase mpd;
	std::vector<std::string> plugins = mpd.listAllPlugins ();

	// remove known problems
	plugins.erase (std::remove (plugins.begin (), plugins.end (), "jni"), plugins.end ());
	plugins.erase (std::remove (plugins.begin (), plugins.end (), "crypto_gcrypt"), plugins.end ());
	plugins.erase (std::remove (plugins.begin (), plugins.end (), "crypto_openssl"), plugins.end ());
	return plugins;
}

class AllPlugins : public ::testing::TestWithParam<std::string>
{
protected:
};

TEST_P (AllPlugins, backend)
{
	using namespace kdb;
	using namespace kdb::tools;
	std::string p = GetParam ();
	// std::cout << p << std::endl;

	try
	{
		Backend b;
		b.addPlugin (PluginSpec (p));
	}
	catch (std::exception const & e)
	{
		EXPECT_TRUE (true) << p;
	}
}

TEST_P (AllPlugins, modules)
{
	using namespace kdb;
	using namespace kdb::tools;
	std::string p = GetParam ();
	// std::cout << p << std::endl;

	try
	{
		Modules m;
		m.load (p);
	}
	catch (std::exception const & e)
	{
		EXPECT_TRUE (true) << p;
	}
}

INSTANTIATE_TEST_CASE_P (AllPlugins, AllPlugins, testing::ValuesIn (getAllPlugins ()));
<commit_msg>crypto-plugin: remove crypto_botan from testkdb_allplugins<commit_after>/**
 * @file
 *
 * @brief Tests for the Backend builder class
 *
 * @copyright BSD License (see doc/COPYING or http://www.libelektra.org)
 *
 */

#define ELEKTRA_PLUGINSPEC_WITH_COMPARE

#include <backend.hpp>
#include <backends.hpp>
#include <plugindatabase.hpp>

#include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>

#include <gtest/gtest.h>
#include <kdb.hpp>

std::vector<std::string> getAllPlugins ()
{
	using namespace kdb;
	using namespace kdb::tools;
	ModulesPluginDatabase mpd;
	std::vector<std::string> plugins = mpd.listAllPlugins ();

	// remove known problems
	plugins.erase (std::remove (plugins.begin (), plugins.end (), "jni"), plugins.end ());
	plugins.erase (std::remove (plugins.begin (), plugins.end (), "crypto_gcrypt"), plugins.end ());
	plugins.erase (std::remove (plugins.begin (), plugins.end (), "crypto_openssl"), plugins.end ());
	plugins.erase (std::remove (plugins.begin (), plugins.end (), "crypto_botan"), plugins.end ());
	return plugins;
}

class AllPlugins : public ::testing::TestWithParam<std::string>
{
protected:
};

TEST_P (AllPlugins, backend)
{
	using namespace kdb;
	using namespace kdb::tools;
	std::string p = GetParam ();
	// std::cout << p << std::endl;

	try
	{
		Backend b;
		b.addPlugin (PluginSpec (p));
	}
	catch (std::exception const & e)
	{
		EXPECT_TRUE (true) << p;
	}
}

TEST_P (AllPlugins, modules)
{
	using namespace kdb;
	using namespace kdb::tools;
	std::string p = GetParam ();
	// std::cout << p << std::endl;

	try
	{
		Modules m;
		m.load (p);
	}
	catch (std::exception const & e)
	{
		EXPECT_TRUE (true) << p;
	}
}

INSTANTIATE_TEST_CASE_P (AllPlugins, AllPlugins, testing::ValuesIn (getAllPlugins ()));
<|endoftext|>