本文整理汇总了C++中Meter类的典型用法代码示例。如果您正苦于以下问题:C++ Meter类的具体用法?C++ Meter怎么用?C++ Meter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Meter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resetVisited
int resetVisited(Element *e){
if (e->type() == "source"){
Source *s = (Source *)e;
s->pin()->visited(false);
}
else if (e->type() == "ground"){
Ground *g = (Ground *)e;
g->pin()->visited(false);
}
else if (e->type() == "resistor"){
Resistor *r = (Resistor *)e;
r->pin("p0")->visited(false);
r->pin("p1")->visited(false);
}
else if (e->type() == "switch"){
Switch *r = (Switch *)e;
r->pin("p0")->visited(false);
r->pin("p1")->visited(false);
r->pin("in")->visited(false);
}
else if (e->type() == "bridge"){
Bridge *b = (Bridge *)e;
b->in()->visited(false);
b->out()->visited(false);
}
else if (e->type() == "meter"){
Meter *g = (Meter *)e;
g->pin()->visited(false);
}
else{
cerr << "Unknown element: "<< e->info()<<endl;
}
return 0;
}
示例2: main
int main()
{
float f = 3.4f; // f, s, l
Meter aa = 3m; // operator""m(3)
aa.print();
}
示例3:
Meter *SimpleGui::addMeter(string name, float &value, float min, float max) {
Meter *slider = (Meter*)INSTANTIATE_WITH_ID("meter", name);
slider->pointToValue(&value);
slider->min = min;
slider->max = max;
slider->width = SIMPLE_GUI_WIDTH;
gui->addChild(slider);
return slider;
}
示例4: Meter
void NetworkProjectionTests::NetworkSetupMeters()
{
Meter* layerMeterOut = new Meter("TestProjectionsLayer1.csv", Storage::CSV);
layerMeterOut->AttachPopulation(this->GetLayer(0));
Meter* layerMeterOut2 = new Meter("TestProjectionsLayer2.csv", Storage::CSV);
layerMeterOut2->AttachPopulation(this->GetLayer(1));
this->AddMeter(layerMeterOut);
this->AddMeter(layerMeterOut2);
}
示例5: setMaxValue
void XMMSSensor::setMaxValue( SensorParams *sp)
{
Meter *meter;
meter = sp->getMeter();
QString f;
f = sp->getParam("FORMAT");
if ( f == "%full" )
meter->setMax( 1 );
}
示例6: StopScrolling
void ControlToolBar::StopPlaying(bool stopStream /* = true*/)
{
StopScrolling();
AudacityProject *project = GetActiveProject();
if(project) {
// Let scrubbing code do some appearance change
project->GetScrubber().StopScrubbing();
}
if (!CanStopAudioStream())
return;
mStop->PushDown();
SetStop(false);
if(stopStream)
gAudioIO->StopStream();
SetPlay(false);
SetRecord(false);
#ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
gAudioIO->AILADisable();
#endif
mPause->PopUp();
mPaused=false;
//Make sure you tell gAudioIO to unpause
gAudioIO->SetPaused(mPaused);
ClearCutPreviewTracks();
mBusyProject = NULL;
// So that we continue monitoring after playing or recording.
// also clean the MeterQueues
if( project ) {
project->MayStartMonitoring();
Meter *meter = project->GetPlaybackMeter();
if( meter ) {
meter->Clear();
}
meter = project->GetCaptureMeter();
if( meter ) {
meter->Clear();
}
}
const auto toolbar = project->GetToolManager()->GetToolBar(ScrubbingBarID);
toolbar->EnableDisableButtons();
}
示例7: SetNativePopulationValues
void SetNativePopulationValues(ObjectMap& object_map) {
for (ObjectMap::iterator<> it = object_map.begin(); it != object_map.end(); ++it) {
Meter* meter = it->GetMeter(METER_POPULATION);
Meter* targetmax_meter = it->GetMeter(METER_TARGET_POPULATION);
// only applies to unowned planets
if (meter && targetmax_meter && it->Unowned()) {
double r = RandZeroToOne();
double factor = (0.1 < r) ? r : 0.1;
meter->SetCurrent(targetmax_meter->Current() * factor);
}
}
}
示例8: setMaxValue
void DiskSensor::setMaxValue( SensorParams *sp )
{
Meter *meter;
meter = sp->getMeter();
const TQString mntPt = sp->getParam( "MOUNTPOINT" );
TQString f;
f = sp->getParam("FORMAT");
if( f == "%fp" || f == "%up" )
meter->setMax( 100 );
else
meter->setMax( getTotalSpace( mntPt ) / 1024 );
}
示例9: TestMathematicalBinaryOperators
void TestMathematicalBinaryOperators()
{
Kilometer const unit_10_kilometer( 10. );
Kilometer const unit_9_kilometer( 9. );
Hectometer const unit_200_hectometer = unit_10_kilometer + unit_10_kilometer;
Assert( fequal( unit_200_hectometer.GetValue(), 200. ) );
Hectometer const unit_10_hectometer = unit_10_kilometer - unit_9_kilometer;
Assert( fequal( unit_10_hectometer.GetValue(), 10. ) );
Meter const unit_31000_meter = unit_10_kilometer + unit_200_hectometer + unit_10_hectometer;
Assert( fequal( unit_31000_meter.GetValue(), 31000. ) );
Scalar const unit_20_ = unit_200_hectometer / unit_10_hectometer;
Assert( fequal( unit_20_, 20. ) );
Scalar const unit_2_ = unit_200_hectometer / unit_10_kilometer;
Assert( fequal( unit_2_, 2. ) );
}
示例10: end
void ProgramSensor::processExited(TDEProcess *)
{
int lineNbr;
SensorParams *sp;
Meter *meter;
TQValueVector<TQString> lines;
TQStringList stringList = TQStringList::split('\n',sensorResult,true);
TQStringList::ConstIterator end( stringList.end() );
for ( TQStringList::ConstIterator it = stringList.begin(); it != end; ++it )
{
lines.push_back(*it);
}
int count = (int) lines.size();
TQObjectListIt it( *objList );
while (it != 0)
{
sp = (SensorParams*)(*it);
meter = sp->getMeter();
if( meter != 0)
{
lineNbr = (sp->getParam("LINE")).toInt();
if ( lineNbr >= 1 && lineNbr <= (int) count )
{
meter->setValue(lines[lineNbr-1]);
}
if ( -lineNbr >= 1 && -lineNbr <= (int) count )
{
meter->setValue(lines[count+lineNbr]);
}
if (lineNbr == 0)
{
meter->setValue(sensorResult);
}
}
++it;
}
sensorResult = "";
}
示例11: SetStop
void ControlToolBar::StopPlaying(bool stopStream /* = true*/)
{
mStop->PushDown();
SetStop(false);
if(stopStream)
gAudioIO->StopStream();
SetPlay(false);
SetRecord(false);
#ifdef AUTOMATED_INPUT_LEVEL_ADJUSTMENT
gAudioIO->AILADisable();
#endif
mPause->PopUp();
mPaused=false;
//Make sure you tell gAudioIO to unpause
gAudioIO->SetPaused(mPaused);
ClearCutPreviewTracks();
mBusyProject = NULL;
// So that we continue monitoring after playing or recording.
// also clean the MeterQueues
AudacityProject *project = GetActiveProject();
if( project ) {
project->MayStartMonitoring();
Meter *meter = project->GetPlaybackMeter();
if( meter ) {
meter->Clear();
}
meter = project->GetCaptureMeter();
if( meter ) {
meter->Clear();
}
}
}
示例12: Meter
Meter* Meter::create(LayerContract * layer) {
Meter * meter = new Meter(layer);
if (meter && meter->initWithSpriteFrameName("meter.png")) {
meter->setRadius(meter->boundingBox().size.height * 0.5f);
meter->setPosition(ccp(layer->getScreenSize().width * 0.8375f, layer->getScreenSize().height * 0.075f));
layer->getGameBatchNode()->addChild(meter, kForeground, sprideIdRocket);
meter->initSprite();
meter->setVisible(false);
return meter;
}
CC_SAFE_DELETE(meter);
return NULL;
}
示例13: TestConstructors
void TestConstructors()
{
Meter const default_constructor;
Assert( fequal( default_constructor.GetValue(), 0. ) );
Meter const explicit_constructor_with_scalar( 2. );
Assert( fequal( explicit_constructor_with_scalar.GetValue(), 2. ) );
Kilometer const one_kilometer( 1. );
Meter unit_1000_meter = one_kilometer;
Assert( fequal( unit_1000_meter.GetValue(), 1000. ) );
Foot const one_foot( 1. );
Meter const _dot_3048_meter = (Inch)one_foot;
Assert( fequal( _dot_3048_meter.GetValue(), .3048 ) );
Meter const copy_constructor = explicit_constructor_with_scalar;
Assert( fequal( copy_constructor.GetValue(), 2. ) );
}
示例14: it
void XMMSSensor::update()
{
QString format;
SensorParams *sp;
Meter *meter;
QObjectListIt it( *objList );
#ifdef HAVE_XMMS
int pos;
QString title;
int songLength = 0;
int currentTime = 0;
bool isPlaying = false;
bool isRunning = xmms_remote_is_running(0);
if( isRunning )
{
isPlaying = xmms_remote_is_playing(0);
pos = xmms_remote_get_playlist_pos(0);
qDebug("unicode start");
title = codec->toUnicode( QCString( xmms_remote_get_playlist_title( 0, pos ) ) );
qDebug("unicode end");
if( title.isEmpty() )
title = "XMMS";
qDebug("Title: %s", title.ascii());
songLength = xmms_remote_get_playlist_time( 0, pos );
currentTime = xmms_remote_get_output_time( 0 );
}
#endif // HAVE_XMMS
while (it != 0)
{
sp = (SensorParams*)(*it);
meter = sp->getMeter();
#ifdef HAVE_XMMS
if( isRunning )
{
format = sp->getParam("FORMAT");
if (format.length() == 0 )
{
format = "%title %time / %length";
}
if( format == "%ms" )
{
meter->setMax( songLength );
meter->setValue( currentTime );
}
else
if ( format == "%full" )
{
meter->setValue( 1 );
}
else
{
format.replace( QRegExp("%title", false), title );
format.replace( QRegExp("%length", false), QTime( 0,0,0 ).
addMSecs( songLength )
.toString( "h:mm:ss" ) );
format.replace( QRegExp("%time", false), QTime( 0,0,0 ).
addMSecs( currentTime )
.toString( "h:mm:ss" ) );
if( isPlaying )
{
format.replace( QRegExp("%remain", false), QTime( 0,0,0 ).
addMSecs( songLength )
.addMSecs(-currentTime )
.toString( "h:mm:ss" ) );
}
else
{
format.replace( QRegExp("%remain", false), QTime( 0,0,0 ).toString("h:mm:ss" ) );
}
meter->setValue(format);
}
}
else
#endif // HAVE_XMMS
{
meter->setValue("");
}
++it;
}
//.........这里部分代码省略.........
示例15: rx
void DiskSensor::processExited(TDEProcess *)
{
TQStringList stringList = TQStringList::split('\n',sensorResult);
sensorResult = "";
TQStringList::Iterator it = stringList.begin();
//TQRegExp rx( "^(/dev/).*(/\\S*)$");
TQRegExp rx( ".*\\s+(/\\S*)$");
while( it != stringList.end())
{
rx.search( *it );
if ( !rx.cap(0).isEmpty())
{
mntMap[rx.cap(1)] = *it;
}
it++;
}
stringList.clear();
TQString format;
TQString mntPt;
SensorParams *sp;
Meter *meter;
TQObjectListIt lit( *objList );
while (lit != 0)
{
sp = (SensorParams*)(*lit);
meter = sp->getMeter();
format = sp->getParam("FORMAT");
mntPt = sp->getParam("MOUNTPOINT");
if (mntPt.length() == 0)
mntPt="/";
if (format.length() == 0 )
{
format = "%u";
}
format.replace( TQRegExp("%fp", false),TQString::number(getPercentFree(mntPt)));
format.replace( TQRegExp("%fg",false),
TQString::number(getFreeSpace(mntPt)/(1024*1024)));
format.replace( TQRegExp("%fkb",false),
TQString::number(getFreeSpace(mntPt)*8) );
format.replace( TQRegExp("%fk",false),
TQString::number(getFreeSpace(mntPt)) );
format.replace( TQRegExp("%f", false),TQString::number(getFreeSpace(mntPt)/1024));
format.replace( TQRegExp("%up", false),TQString::number(getPercentUsed(mntPt)));
format.replace( TQRegExp("%ug",false),
TQString::number(getUsedSpace(mntPt)/(1024*1024)));
format.replace( TQRegExp("%ukb",false),
TQString::number(getUsedSpace(mntPt)*8) );
format.replace( TQRegExp("%uk",false),
TQString::number(getUsedSpace(mntPt)) );
format.replace( TQRegExp("%u", false),TQString::number(getUsedSpace(mntPt)/1024));
format.replace( TQRegExp("%tg",false),
TQString::number(getTotalSpace(mntPt)/(1024*1024)));
format.replace( TQRegExp("%tkb",false),
TQString::number(getTotalSpace(mntPt)*8));
format.replace( TQRegExp("%tk",false),
TQString::number(getTotalSpace(mntPt)));
format.replace( TQRegExp("%t", false),TQString::number(getTotalSpace(mntPt)/1024));
meter->setValue(format);
++lit;
}
if ( init == 1 )
{
emit initComplete();
init = 0;
}
}