const std::vector<std::string> Environment::ScanPorts() const
{
    std::vector<std::string> validNames;
    std::string portName;

    for(unsigned int i = 1; i < 17; i++)
    {
        portName = "Com";
        portName.append( boost::lexical_cast<std::string>(i));
        #ifdef SERIALCONNECTION_DEBUG
            std::cout << "Trying port name: " << portName << "...";
        #endif // SERIALCONNECTION_DEBUG
        SerialDeviceEnumeration Enum(portName, 9600);
        SerialConnection Connection(io_service, Enum);
        if( !Connection.Connect() )
        {
            #ifdef SERIALCONNECTION_DEBUG
                std::cout << "valid.\n";
            #endif // SERIALCONNECTION_DEBUG
            validNames.push_back(portName);
        }
        else
        {
            #ifdef SERIALCONNECTION_DEBUG
                std::cout << "invalid.\n";
            #endif // SERIALCONNECTION_DEBUG
        }
        Connection.Disconnect();
    }
    return validNames;
}
		Enum ConvertToEnum(const char* str) {
			for (int i = 0; i <= LAST; ++i) {
				if (_stricmp(str, STRINGS[i]) == 0)
					return Enum(i);
			}
			return Permutation;
		}
Beispiel #3
0
 const std::vector<const Parameter*> ConvertPixelType::setupParameters()
 {
     std::vector<const runtime::Parameter*> parameters;
     
     EnumParameter* pixelType = new EnumParameter(PIXEL_TYPE);
     pixelType->setTitle("Pixel type");
     pixelType->setAccessMode(runtime::Parameter::ACTIVATED_WRITE);
     pixelType->add(EnumDescription(Enum(runtime::Image::MONO_8), "Mono image 8-bit"));
     pixelType->add(EnumDescription(Enum(runtime::Image::RGB_24), "RGB image 24-bit"));
     pixelType->add(EnumDescription(Enum(runtime::Image::BGR_24), "BGR image 24-bit"));
     pixelType->add(EnumDescription(Enum(runtime::Image::BAYERBG_8), "Bayer BG pattern 8-bit"));
     pixelType->add(EnumDescription(Enum(runtime::Image::BAYERGB_8), "Bayer GB pattern 8-bit"));
     parameters.push_back(pixelType);
                                 
     return parameters;
 }
Beispiel #4
0
BOOL CDAuditWizard::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CComboBox* pcbProcName;

	pcbProcName = (CComboBox*) GetDlgItem(IDC_COMBO_PROCESS);
	if (pcbProcName != NULL)
	{
		CStringList pr_list;
		CEnumProcess Enum(&pr_list);
		Enum.EnumProcesses();
		pr_list.AddTail("*");
		
		POSITION pos;

		
		for(pos = pr_list.GetHeadPosition(); pos != NULL;)
		{
			pcbProcName->AddString(pr_list.GetNext(pos));
		}
		pcbProcName->SetCurSel(0);
	}

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Beispiel #5
0
const Enum Enum::fromString( const std::string & str ) const
{
	typedef std::vector< std::pair< int, std::string> > PairContainer;
	
	const PairContainer	pairs = valuesAndStrings();

	for( PairContainer::const_iterator i = pairs.begin(); i != pairs.end(); ++i )
	{
		if( i->second == str )
		{
			return Enum(i->first);
		}
	}

	return Enum();
}
Beispiel #6
0
 void ReadGpioTest::setUp()
 {
     m_operator = new OperatorTester(new ReadGpio());
     m_operator->initialize();
     m_operator->setParameter(ReadGpio::GPIO, Enum(4));
     m_operator->activate();
 }
Beispiel #7
0
 void PushTest::setUp ( void )
 {
     m_operator = new runtime::OperatorTester(new Push());
     m_operator->setParameter(Push::DATA_TYPE, Enum(Variant::BOOL.id()));
     m_operator->initialize();
     m_operator->activate();
 }
Beispiel #8
0
	void EnumExec(PCWSTR clname, Functor Func, PVOID data = nullptr) {
		WmiEnum	ewco(Enum(clname));

		WmiObject	obj;
		ULONG count = 0;
		while (ewco && SUCCEEDED(ewco->Next(WBEM_INFINITE, 1, &obj, &count)) && count) {
			if (!Func(*this, obj, data))
				break;
		}
	}
typename boost::enable_if_c<enum_names<Enum>::named, std::ostream &>::type
operator<<(std::ostream & os, Enum value) {
	if(value >= Enum(0)) {
		size_t i = size_t(value);
		if(i < enum_names<Enum>::count) {
			return os << enum_names<Enum>::names[value];
		}
	}
	return os << "(unknown:" << int(value) << ')';
}
std::ostream & operator<<(std::ostream & os, flags<Enum> _flags) {
	color::shell_command prev = color::current;
	if(_flags) {
		bool first = true;
		for(size_t i = 0; i < flags<Enum>::bits; i++) {
			if(_flags & Enum(i)) {
				if(first) {
					first = false;
				} else {
					os << color::dim_white << ", " << prev;
				}
				os << Enum(i);
			}
		}
		return os;
	} else {
		return os << color::dim_white << "(none)" << prev;
	}
}
 void visit(const char* name, const boost::array<DataType, N>&, const char*, Enum)
 {
   for(size_t i=0; i<N; i++)
     {
       _gc._ydata.push_back(QVector<double>());
       _gc._ydata.back().reserve(_gc._maxSamples);
       std::stringstream ss;
       ss<<name<<'.'<<Enum(i);
       _gc._names.push_back(QString::fromStdString(ss.str()));
     }
 }
Beispiel #12
0
	void main(){
		while (true) {
			Recv((char*)&start, sizeof(long long));
			Recv((char*)&end, sizeof(long long));
			Recv((char*)&CHARSET_LENGTH, sizeof(unsigned));
			CHARSET=new char[CHARSET_LENGTH];
			Recv(CHARSET, CHARSET_LENGTH);
			auto result = Enum(start, end, CHARSET, CHARSET_LENGTH);
			Send((char*)result, (end-start)*sizeof(pair<uint64_t, uint64_t>));
		}
	}
Beispiel #13
0
 const std::vector<const Parameter*> ReadDirectory::setupParameters()
 {
     std::vector<const runtime::Parameter*> parameters;
     
     EnumParameter* directory = new EnumParameter(DIRECTORY);
     directory->setTitle(L_("Directory"));
     directory->setAccessMode(runtime::Parameter::INITIALIZED_WRITE);
     parameters.push_back(directory);
     
     directory->add(EnumDescription(Enum(NO_DIRECTORY), L_("None")));
     boost::filesystem::path path (BASE_DIRECTORY);
     m_directoryMap.clear();
     std::vector<std::string> dirNames;
     if (boost::filesystem::exists(path))
     {
         if (boost::filesystem::is_directory(path))
         {
             for(boost::filesystem::directory_iterator iter(path);
                 iter != boost::filesystem::directory_iterator();
                 ++iter)
             {
                 if (! boost::filesystem::is_directory(iter->path()))
                     continue;
                 
                 dirNames.push_back(iter->path().filename().string());
             }
         }
     }
     
     std::sort(dirNames.begin(), dirNames.end());
     std::size_t i = NO_DIRECTORY + 1;
     for (std::vector<std::string>::const_iterator iter = dirNames.begin();
          iter != dirNames.end(); ++iter)
     {
         directory->add(EnumDescription(Enum(i), *iter));
         m_directoryMap[i] = *iter;
         i++;
     }
                                 
     return parameters;
 }
Beispiel #14
0
// Ausgabefunktionen ----------------------------------------------------------
Bool DPunkt :: OutPut (void) {

long locEnum = Enum();
long locEnum2 = Enum2();
long locEbene = Ebene() + PUNKTEBENE0;
DGeoObj *plocDGO = r_flag ? this : NULL;

	if (h_flag && pGDBElemente -> FindOrEnter (locEnum, locEnum2, plocDGO)) 
		return FALSE;		// bereits ausgegeben

// nur alles bis zu einer vorgegebenen Stufe ausgeben
	if (Stufe() > MaxPunktStufe) 
		return FALSE;

	if (!s_flag) {
		fprintf (stderr, "GDB-Element(PG): %7ld/%ld     \r", cntEl++, locEnum);
		fflush (stderr);
	}

// IdentifikatorSatz ausgeben
	fprintf (yyout, "P %10ld  %08ld      1\n", locEnum, locEbene);

// Merkmale ausgeben
	if (strcmp (_PunktKennzeichen, "T0") && *_PunktKennzeichen != '\0') 
		OutputMK (MKPKZ, _PunktKennzeichen);
	if (_PunktNummer > 0) 
		OutputMK (MKPNR, _PunktNummer);
	if (_Text) 
		OutputMK (MKPTEXT, _Text);
	if (_Name)
		OutputMK (MKPNAME, _Name);
	if (_Code)
		OutputMK (MKPCODE, _Code);	// DB-AnkopplungsCode

// auf evtl. Begleitobjekt beziehen
	if (_RelSatz) {
		fprintf (yyout, "R B %08ld\n", _RelSatz);
		_RelSatz = 0;
	}

// PunktGeoemtrie ausgeben
	fprintf (yyout, "G %10.4lf %10.4lf\n", X(), Y());
//	fflush (yyout);

return TRUE;
}
Beispiel #15
0
Enum Foam::NamedEnum<Enum, nEnum>::read(Istream& is) const
{
    word name(is);

    HashTable<int>::const_iterator iter = find(name);

    if (iter == HashTable<int>::end())
    {
        FatalIOErrorIn
        (
            "NamedEnum<Enum, nEnum>::read(Istream&) const", is
        )   << name << " is not in enumeration: "
            << toc() << exit(FatalIOError);
    }

    return Enum(iter());
}
Beispiel #16
0
VOID ListTable(  IN PCHAR TableName, IN PCHAR ColumnName, IN PCHAR IndexName)
{
    JET_TABLEID     TableId;
    JET_COLUMNDEF   ColumnDef;

    Call( JetOpenTable( SesId, DbId, TableName, NULL, 0,
            JET_bitTableDenyWrite, &TableId));

    Call( JetGetTableColumnInfo( SesId, TableId, ColumnName, &ColumnDef,
            sizeof( ColumnDef), JET_ColInfo));

    RplDbgPrint(( "\tTable: %s\n", TableName));

    Enum( TableId, ColumnDef.columnid, IndexName);

    Call( JetCloseTable( SesId, TableId));
}
Beispiel #17
0
Bool DLinie :: OutPut (void) {

long locEnum = Enum();
long locEnum2 = Enum2();
long Cnt = Count();
long locEbene = Ebene() + LINIENEBENE0;
DGeoObj *plocDGO = r_flag ? this : NULL;

	if (h_flag && pGDBElemente -> FindOrEnter (locEnum, locEnum2, plocDGO)) 
		return FALSE;		// bereits ausgegeben

// nur alles bis zu einer vorgebebenen Stufe ausgeben
	if (Stufe() > MaxLinienStufe)
		return FALSE;

	if (!s_flag) {
		fprintf (stderr, "GDB-Element(LI): %7ld/%ld     \r", cntEl++, locEnum);
		fflush (stderr);
	}

// IdentifikatorSatz ausgeben
	fprintf (yyout, "L %10ld  %08ld  %5ld\n", locEnum, locEbene, Cnt);

	if (_Name)
		OutputMK (MKLNAME, _Name);
	if (_Code)
		OutputMK (MKLCODE, _Code);	// DB-AnkopplungsCode
	if (_Text) 
		OutputMK (MKLTEXT, _Text);	// eigentlicher Text

// auf evtl. Begleitobjekt beziehen
	if (_RelSatz) {
		fprintf (yyout, "R B %08ld\n", _RelSatz);
		_RelSatz = 0;
	}

// Geometrie ausgeben
CRing r (*_pDPL);

	OutputGI (r, Cnt);

return TRUE;
}
 const Registry::Key::KeysPoolPtr Registry::Key::GetChildKeys() const
 {
   KeysPoolPtr RetPool(new KeysPool);
   for (RefObjQIPtr<IFaces::INamedVariable> Var = Keys.First() ;
     Var.Get() ; Var = Keys.Next())
   {
     RefObjPtr<IFaces::IVariant> Value;
     if (Var->Get(Value.GetPPtr()) != IFaces::retOk)
       throw RegistryException("Can't get value");
     if (Value->GetType() != IFaces::IVariant::vtIBase)
       throw RegistryException("Unknown child item");
     RefObjPtr<IFaces::IBase> ChildItem;
     if (Value->GetValue(reinterpret_cast<void**>(ChildItem.GetPPtr())) != IFaces::retOk)
       throw RegistryException("Can't get child enum");
     RefObjQIPtr<IFaces::IEnum> Enum(ChildItem);
     if (!Enum.Get())
       throw RegistryException("Unknown child item");
     RetPool->push_back(KeyPtr(new Key(IFacesImpl::IEnumHelper(Enum), Var->GetName())));
   }
   return RetPool;
 }
Beispiel #19
0
int encode(flatcc_builder_t *B, void *buffer, size_t *size)
{
    int i, veclen = 3;
    void *buffer_ok;

    flatcc_builder_reset(B);

    C(start_as_root(B));
    C(list_start(B, 0));
    for (i = 0; i < veclen; ++i) {
        /*
         * By using push_start instead of push_create we can construct
         * the sibling field (of Bar type) in-place on the stack,
         * otherwise we would need to create a temporary Bar struct.
         */
        C(list_push_start(B));
        FooBar(sibling_create(B,
                0xABADCAFEABADCAFE + i, 10000 + i, '@' + i, 1000000 + i,
                123456 + i, 3.14159f + i, 10000 + i));
        FooBar(name_create_str(B, "Hello, World!"));
        FooBar(rating_add(B, 3.1415432432445543543 + i));
        FooBar(postfix_add(B, '!' + i));
        C(list_push_end(B));
    }
    C(list_end(B));
    C(location_create_str(B, "https://www.example.com/myurl/"));
    C(fruit_add(B, Enum(Bananas)));
    C(initialized_add(B, True));
    C(end_as_root(B));

    /*
     * This only works with the default emitter and only if the buffer
     * is larger enough. Otherwise use whatever custom operation the
     * emitter provides.
     */
    buffer_ok = flatcc_builder_copy_buffer(B, buffer, *size);
    *size = flatcc_builder_get_buffer_size(B);
    return !buffer_ok;
}
Beispiel #20
0
bool nglVideoMode::Find (nglVideoMode& rMode, uint Width, uint Height, uint Depth, uint Frequency)
{
#ifdef _WIN32_
  if (!Depth || ! Frequency)
  {
    DEVMODE mode;

    EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &mode);
    if (!Depth) Depth = mode.dmBitsPerPel;
    if (!Frequency) Frequency = mode.dmDisplayFrequency;
  }
#endif  // _WIN32_

  uint i = 0;
  bool have_match = false;
  nglVideoMode mode;

  while (Enum(mode, i++))
  {
    if (Width  == mode.GetWidth() &&
        Height == mode.GetHeight() &&
        Depth  == mode.GetDepth())
    {
      uint freq = mode.GetFrequency();

      if (freq >= Frequency &&
          (!have_match || freq < rMode.GetFrequency()))
      {
        rMode = mode;
        have_match = true;
      }
    }
  }

  return have_match;
}
Beispiel #21
0
EditMode::Enum EditMode::GetNextMode() const {
    return Enum((_mode + 1) % editMode_t::NUM_MODES);
}
Beispiel #22
0
	Enum enumerate_sessions(const wchar_t* host)
	{
		auto ret = simstd::make_unique<ImplEnum>(host);
		ret->update();
		return Enum(simstd::move(ret));
	}
Beispiel #23
0
		Enum getEnum(const char* name) { return Enum(static_cast<uint8>(indexToValue((indexOf(name, names, count))))); }
Beispiel #24
0
int Workout()
{
    Enum();
    CreateMap();    
    return hungary(Rowl, Coll, g_list);
}
Beispiel #25
0
HRESULT RegWrap::EnumValues( std::vector<tstring>& v ) const { return Enum( v, ::RegEnumValue ); }
Beispiel #26
0
int FTP::GetFindData(PluginPanelItem **pPanelItem, int *pItemsNumber, int OpMode)
{
	PROC(("FTP::GetFindData",NULL))
	DWORD        b,e;
	char            *Data[3];
	*pPanelItem   = NULL;
	*pItemsNumber = 0;

//Hosts
	if(ShowHosts)
	{
		EnumHost        Enum(HostsPath);
		FP_SizeItemList il(FALSE);
		PluginPanelItem tmp;
		FTPHost         h;

		if(!IS_SILENT(OpMode))
		{
			memset(&tmp, 0, sizeof(tmp));
			strcpy(tmp.FindData.cFileName,"..");
			tmp.FindData.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;

			if(!IS_SILENT(OpMode))
			{
				tmp.Description               = (char *)"..";
				tmp.CustomColumnNumber        = 3;
				tmp.CustomColumnData          = Data;
				tmp.CustomColumnData[0]       = (char *)"..";
				tmp.CustomColumnData[1]       = (char *)"..";
				tmp.CustomColumnData[2]       = (char *)"..";
			}

			if(!il.Add(&tmp))
				return FALSE;
		}

		while(true)
		{
			if(!Enum.GetNextHost(&h))
				break;

			if(!h.Read(NULL))
				continue;

			memset(&tmp, 0, sizeof(tmp));
			/* Panel item MUST have name the save as file saved to disk
			   in case you want to copy between panels work.
			*/
			h.MkINIFile(tmp.FindData.cFileName,NULL,"");
			tmp.FindData.ftLastWriteTime  = h.LastWrite;
			tmp.FindData.dwFileAttributes = h.Folder ? FILE_ATTRIBUTE_DIRECTORY : 0;
			tmp.Flags                     = PPIF_USERDATA;
			tmp.PackSizeHigh              = FTP_HOSTID;
			tmp.UserData                  = (DWORD_PTR)&h;

			if(!IS_SILENT(OpMode))
			{
				tmp.Description               = h.HostDescr;
				tmp.CustomColumnNumber        = 3;
				tmp.CustomColumnData          = Data;
				tmp.CustomColumnData[0]       = h.Host;  //C0
				tmp.CustomColumnData[1]       = h.Home;  //C1
				tmp.CustomColumnData[2]       = h.User;  //C2
			}

			if(!il.Add(&tmp))
				return FALSE;

			Log(("Item[%d]=[%s] attr=%08X",
			     il.Count()-1, FTP_FILENAME(il.Item(il.Count()-1)),
			     il.Item(il.Count()-1)->FindData.dwFileAttributes));
		}

		*pPanelItem   = il.Items();
		*pItemsNumber = il.Count();
		return TRUE;
	}

//FTP
	FP_Screen _scr;
	FTPFileInfo FileInfo;

	if(!hConnect)
	{
		goto AskConnect;
	}

Restart:

	if(!FtpFindFirstFile(hConnect, "*", &FileInfo, &ResetCache))
	{
		if(GetLastError() == ERROR_NO_MORE_FILES)
		{
			*pItemsNumber = 0;
			return TRUE;
		}

		if(SwitchingToFTP && GetLastError() == ERROR_CANCELLED)
		{
			;
		}
		else
		{
			if(CurrentState == fcsExpandList)
			{
				FreeFindData(*pPanelItem,*pItemsNumber);
				*pPanelItem   = NULL;
				*pItemsNumber = 0;
				return FALSE;
			}

//Query reconnect
			do
			{
				if(!hConnect)
					break;

				if(GetLastError() == ERROR_CANCELLED)
					break;

				if(!hConnect->ConnectMessageTimeout(MConnectionLost,Host.HostName,-MRestore))
				{
					Log(("WaitMessage cancelled"));
					break;
				}

				if(FtpCmdLineAlive(hConnect) &&
				        FtpKeepAlive(hConnect))
					goto Restart;

				if(SelectFile.Length() && CurrentState != fcsExpandList)
					SaveUsedDirNFile();

AskConnect:

				if(Connect())
					goto Restart;
				else
					break;
			}
			while(true);
		}

		if(!ShowHosts)
			BackToHosts();

		FreeFindData(*pPanelItem, *pItemsNumber);
		return GetFindData(pPanelItem,pItemsNumber,OpMode);
	}

	GET_TIME(b);

	do
	{
		if(Opt.ShowIdle)
		{
			char str[ 200 ];
			GET_TIME(e);

			if(CMP_TIME(e,b) > 0.5)
			{
				_snprintf(str,ARRAYSIZE(str),"%s%d", FP_GetMsg(MReaded), *pItemsNumber);
				SetLastError(ERROR_SUCCESS);
				IdleMessage(str,Opt.ProcessColor);
				b = e;

				if(CheckForEsc(FALSE))
				{
					SetLastError(ERROR_CANCELLED);
					return FALSE;
				}
			}
		}

		PluginPanelItem *NewPanelItem=*pPanelItem;

		if((*pItemsNumber % 1024) == 0)
		{
			if(!NewPanelItem)
				NewPanelItem = (PluginPanelItem *)malloc((1024+1)*sizeof(PluginPanelItem));
			else
				NewPanelItem = (PluginPanelItem *)realloc(NewPanelItem,(*pItemsNumber+1024+1)*sizeof(PluginPanelItem));

			if(NewPanelItem == NULL)
			{
				/*-*/Log(("GetFindData(file)::!reallocate plugin panels items %d -> %d",*pItemsNumber,*pItemsNumber+1024+1));
				return FALSE;
			}

			*pPanelItem=NewPanelItem;
		}

		PluginPanelItem *CurItem = &NewPanelItem[*pItemsNumber];
		memset(CurItem, 0, sizeof(PluginPanelItem));
		CurItem->FindData = FileInfo.FindData;

		if(!IS_SILENT(OpMode))
		{
			CurItem->CustomColumnNumber             = FTP_COL_MAX;
			CurItem->Owner                          = FileInfo.FTPOwner[0] ? strdup(FileInfo.FTPOwner) : NULL;
			CurItem->CustomColumnData               = (LPSTR*)malloc(sizeof(LPSTR*)*FTP_COL_MAX);
			CurItem->CustomColumnData[FTP_COL_MODE] = strdup(FileInfo.UnixMode);
			CurItem->CustomColumnData[FTP_COL_LINK] = strdup(FileInfo.Link);
			hConnect->ToOEM(CurItem->CustomColumnData[FTP_COL_LINK]);
		}

		(*pItemsNumber)++;
	}
	while(FtpFindNextFile(hConnect,&FileInfo));

	return TRUE;
}
Beispiel #27
0
		inline std::pair<size_t, DisplayMode> Get(
			Preference preference = Preference::AspectMin,
			const Optional<Size>& targetResolution = none,
			const Optional<int32>& targetRefreshRate = 60,
			const Optional<size_t>& targetDisplayIndex = 0)
		{
			Array<Setting> results = Enum(targetResolution, targetRefreshRate, targetDisplayIndex);

			if (results.size() == 1)
			{
				const auto& reuslt = results.front();

				return{ reuslt.displayIndex, reuslt.dislayMode };
			}

			if (!targetResolution)
			{
				if (preference == Preference::AspectMin)
				{
					preference = Preference::Min;
				}
				else if (preference == Preference::AspectMin)
				{
					preference = Preference::Max;
				}
			}

			if (preference == Preference::Min)
			{
				const auto& reuslt = results.stable_sort_by([](const auto& a, const auto& b)
				{
					return (a.dislayMode.size.x * a.dislayMode.size.y) < (b.dislayMode.size.x * b.dislayMode.size.y);
				}).front();

				return{ reuslt.displayIndex, reuslt.dislayMode };
			}
			else if (preference == Preference::Max)
			{
				const auto& reuslt = results.stable_sort_by([](const auto& a, const auto& b)
				{
					return (a.dislayMode.size.x * a.dislayMode.size.y) > (b.dislayMode.size.x * b.dislayMode.size.y);
				}).front();

				return{ reuslt.displayIndex, reuslt.dislayMode };
			}
			else if (preference == Preference::AspectMin)
			{
				results.stable_sort_by([](const auto& a, const auto& b)
				{
					return (a.dislayMode.size.x * a.dislayMode.size.y) < (b.dislayMode.size.x * b.dislayMode.size.y);
				});

				const auto& reuslt = results.stable_sort_by([](const auto& a, const auto& b)
				{
					double ar = std::abs(1.0 - a.xScale);
					double br = std::abs(1.0 - b.xScale);
					
					if (ar < 0.005)
					{
						ar = 0.0;
					}

					if (br < 0.005)
					{
						br = 0.0;
					}

					return ar < br;
				}).front();

				return{ reuslt.displayIndex, reuslt.dislayMode };
			}
			else // preference == Preference::AspectMax
			{
				results.stable_sort_by([](const auto& a, const auto& b)
				{
					return (a.dislayMode.size.x * a.dislayMode.size.y) > (b.dislayMode.size.x * b.dislayMode.size.y);
				});

				const auto& reuslt = results.stable_sort_by([](const auto& a, const auto& b)
				{
					double ar = std::abs(1.0 - a.xScale);
					double br = std::abs(1.0 - b.xScale);

					if (ar < 0.005)
					{
						ar = 0.0;
					}

					if (br < 0.005)
					{
						br = 0.0;
					}

					return ar < br;
				}).front();

				return{ reuslt.displayIndex, reuslt.dislayMode };
			}
		}
Beispiel #28
0
	Enum enumerate_sessions()
	{
		auto ret = simstd::make_unique<ImplEnum>();
		ret->update();
		return Enum(simstd::move(ret));
	}
Beispiel #29
0
Bool DText :: OutPut (void) {

long locEnum = Enum();
long locEnum2 = Enum2();
long locEbene = Ebene() + TEXTEBENE0;
DGeoObj *plocDGO = r_flag ? this : NULL;

	if (h_flag && pGDBElemente -> FindOrEnter (locEnum, locEnum2, plocDGO)) 
		return FALSE;		// bereits ausgegeben

// nur alles bis zu einer vorgegebenen Stufe ausgeben
	if (Stufe() > MaxTextStufe) 
		return FALSE;

	if (!s_flag) {
		fprintf (stderr, "GDB-Element(TX): %7ld/%ld     \r", cntEl++, locEnum);
		fflush (stderr);
	}

char outBuff[80];
int iTHoehe, iTBreite;

	if (!b_flag) {
	// IdentifikatorSatz ausgeben
		fprintf (yyout, "P %10ld  %08ld      1\n", locEnum, locEbene);

	// Merkmale Ausgeben
		if (_Text) 
			OutputMK (MKTTEXT, _Text);	// eigentlicher Text
		if (_THoehe != -1.0 && _THoehe != 0.0) 
			OutputMK (MKTHOEHE, _THoehe);	// TextH�he
		if (_TLaenge != -1.0 && _TLaenge != 0.0)
			OutputMK (MKTLAENGE, _TLaenge);	// TextL�nge
		if (_TModus != -1.0)
			OutputMK (MKTMODUS, _TModus);	// TextModus
		if (_Code)
			OutputMK (MKTCODE, _Code);	// DB-AnkopplungsCode
		OutputMK (MKTSWINKEL, _TSWinkel);	// TORIENT
		OutputMK (MKTWINKEL, _Winkel);	// TextWinkel

	char Richt[2];

		Richt[0] = (char)_TRicht;
		Richt[1] = '\0';
		OutputMK (MKTRICHT, Richt);	// TextAusrichtung

	// VisInfo als Merkmal ausgeben
	int iTTyp = 0x0;

		switch (_TRicht) {
		default:
		case 'L':
			break;

		case 'M':
			iTTyp |= TV_CentreAlign;
			break;

		case 'R':
			iTTyp |= TV_RightAlign;
			break;
		}
		

		if (_THoehe != -1 && _TModus != -1) {
			iTHoehe = int(_THoehe / 0.3176);
			iTBreite = int((_THoehe * _TModus) / 0.3176);
			sprintf (outBuff, "x { r=%d; o=%d; s=%d,%d; y=0x%x; }", -(int)_Winkel, -(int)_TSWinkel, -iTHoehe, iTBreite, iTTyp);
		} else {
			sprintf (outBuff, "x { r=%d; o=%d; y=0x%x; }", -(int)_Winkel, -(int)_TSWinkel, iTTyp);
		}
		OutputMK (MKTVISINFO, outBuff);

	// Geoemtrie des Bezugspunktes ausgeben
		fprintf (yyout, "G %12.5lf %12.5lf\n;\n", X(), Y());
//		fflush (yyout);
	} else if (_Text) {
	// Texte als Begleitobjekte ausgeben
		fprintf (yyout, "B %10ld  %08ld      1\n", locEnum, locEbene);

	// eigentlichen Text ausgeben
		OutputTO (_Text);

	// VisInfo als Merkmal ausgeben
	int iTTyp = 0x0;

		switch (_TRicht) {
		default:
		case 'L':
			break;

		case 'M':
			iTTyp |= TV_CentreAlign;
			break;

		case 'R':
			iTTyp |= TV_RightAlign;
			break;
		}
		
		if (_THoehe != -1 && _TModus != -1) {
			iTHoehe = int(_THoehe / 0.3176);
			iTBreite = int((_THoehe * _TModus) / 0.3176);
			sprintf (outBuff, "x { r=%d; o=%d; s=%d,%d; y=0x%x; }", -(int)_Winkel, -(int)_TSWinkel+(int)_Winkel, -iTHoehe, iTBreite, iTTyp);
		} else {
			sprintf (outBuff, "x { r=%d; o=%d; y=0x%x; }", -(int)_Winkel, -(int)_TSWinkel+(int)_Winkel, iTTyp);
		}
		OutputMK (MKTVISINFO, outBuff);

	// Geoemtrie des Bezugspunktes ausgeben
		fprintf (yyout, "G %10.4lf %10.4lf\n;\n", X(), Y());
//		fflush (yyout);
	}

return TRUE;
}
Beispiel #30
0
Bool DFlaeche :: OutPut (void) {

long locEnum = Enum();
long locEnum2 = Enum2();
long Cnt = Count();
long locEbene = Ebene() + FLAECHENEBENE0;
DGeoObj *plocDGO = r_flag ? this : NULL;

	if (h_flag && pGDBElemente -> FindOrEnter (locEnum, locEnum2, plocDGO)) 
		return FALSE;		// bereits ausgegeben

// nur alles bis zu einer vorgegebenen Stufe ausgeben
	if (Stufe() > MaxFlaechenStufe) 
		return FALSE;

	if (!s_flag) {
		fprintf (stderr, "GDB-Element(FL): %7ld/%ld     \r", cntEl++, locEnum);
		fflush (stderr);
	}

#if defined(EWU)
// spezialFall f�r EWU
	if (_Pointer[0] != '\0') {
	long Ident = atol (_Pointer);

		fprintf (yyout, "F %10ld 00910%3ld  %5ld\n", locEnum, Ident/1000, Cnt);
	} else
#endif
// IdentifikatorSatz ausgeben
	fprintf (yyout, "F %10ld  %08ld  %5ld\n", locEnum, locEbene, Cnt);

// Merkmale Ausgeben
	if (_Text) 
		OutputMK (MKFTEXT, _Text);	// eigentlicher Text
	if (_XKoord != -1.0 || _YKoord != -1.0) { 
	// Bezugspunkt der F�che ausgeben
		OutputMK (MKFXKOORD, _XKoord);
		OutputMK (MKFYKOORD, _YKoord);
	}
	if (_SWinkel != -1.0 && _SWinkel != 0.0)
		OutputMK (MKFSWINKEL, _SWinkel);	// Schraffurwinkel
	if (_SAbstand != -1.0 && _SAbstand != 0.0)
		OutputMK (MKFSABSTAND, _SAbstand);	// Schraffurabstand
	if (_Code)
		OutputMK (MKFCODE, _Code);	// DB-AnkopplungsCode
	if (_Pointer[0] != '\0')		// #JB921506
		OutputMK (MKFPOINTER, _Pointer);// dBase-AnkopplungsCode
	if (_Name)
		OutputMK (MKFNAME, _Name);

// auf evtl. Begleitobjekt beziehen
	if (_RelSatz) {
		fprintf (yyout, "R B %08ld\n", _RelSatz);
		_RelSatz = 0;
	}

// Geometrie ausgeben
CRing rF (*_pDLL);
int i = 0;

	for (i = 0, rF.First(); rF.Valid(); i++, rF.Next()) {
	DLinieLock l(rF);

		if (l) {
		CRing r(*(l -> _pDPL));

			OutputGI (r, l -> _pDPL -> Count());
			fprintf (yyout, "T\n");		//TrennSatz einf�gen
		} else
			break;
	}

return TRUE;
}