예제 #1
0
FGrab::FGrab(boost::shared_ptr<AL::ALBroker> broker,
             const std::string& name)
    : AL::ALModule(broker, name) {
  // Describe the module here. This will appear on the webpage
  setModuleDescription("Grab raw frames from the active camera.");

  functionName("grab_to_file", getName(), "Grab a frame and write it in a file. "
               "It is not necessary to call release() afterwards.");
  addParam("file", "The path and name of the file to be written");
  BIND_METHOD(FGrab::grab_to_file);

  functionName("grab", getName(), "Returns a buffer containing a raw YUV422 picture. "
               "This buffer is not to be freed manually. Call release() for cleanup.");
  setReturn("unsigned char[]", "Buffer containing the YUV422 video frame");
  BIND_METHOD(FGrab::grab);

  functionName("getImageSize", getName(), "Returns the size in bytes of the buffer "
               "currently on hold.");
  setReturn("char[]", "Buffer containing the YUV422 video frame");
  BIND_METHOD(FGrab::grab);
  
  // Release the buffer, necessary before calling grab again
  functionName("release", getName(), "Releases the buffer allocated by grab().");
  BIND_METHOD(FGrab::release);

  functionName("switchCamera", getName(), "Switch to the camera passed in parameter.");
  addParam("camera", "The camera code");
  BIND_METHOD(FGrab::release);
}
예제 #2
0
//______________________________________________
// constructor
//______________________________________________
mainModule::mainModule(boost::shared_ptr<AL::ALBroker> broker, const std::string& name) :
		AL::ALModule(broker, name)
{
	std::string bodyId, headId;
	setModuleDescription("This is the Kouretes Team root module ");
	functionName("Start", "mainModule", "Method to start Talws");
	BIND_METHOD(mainModule::Start);
	functionName("Stop", "mainModule", "Method to stop Talws");
	BIND_METHOD(mainModule::Stop);
	boost::shared_ptr<AL::ALMemoryProxy> memory;
	KAlBroker::Instance().SetBroker(broker);
	try
	{
		memory = KAlBroker::Instance().GetBroker()->getMemoryProxy();
	} catch (AL::ALError& e)
	{
		std::cerr << "Error in getting memory proxy" << std::endl;
		std::cout << e.what() << std::endl;
	}

	try
	{
		bodyId = std::string(memory->getData("Device/DeviceList/ChestBoard/BodyId"));
		headId = std::string(memory->getData("RobotConfig/Head/HeadId"));
		if (bodyId.size() > 15)
		{
			bodyId = bodyId.substr(16, 19);/*bodyId.size()-5, bodyId.size()-2*/ //manually because aldebarab forgot to put a \0...
		} else
		{
			try
			{
				bodyId = bodyId.substr(11, 14);
			} catch (const std::out_of_range& oor)
			{
				std::cerr << "Out of Range error: " << oor.what() <<" " <<  bodyId << '\n';
			}


		}
	} catch (AL::ALError& e)
	{
		std::cerr << "Error in getting body and/or head id`s" << std::endl;
		bodyId = "";
		headId = "";
	}

	std::cout << "KRobot - Found Head ID: '" << headId << "'" << std::endl;
	//std::cout << "KRobot - Found Body ID: '" << _toString(KRobotConfig::Instance().getConfig(KDeviceLists::Interpret::BODY_ID).size()) << "'" << std::endl;
	std::cout << "KRobot - Found Body ID: '" << bodyId << "'" << std::endl;
#ifndef KROBOT_IS_REMOTE
	Configurator::Instance().initConfigurator("/home/nao/naoqi/config/", headId, bodyId);
#else
	Configurator::Instance().initConfigurator("./config/", "", "");
#endif
	tal = new Talws();
}
예제 #3
0
void
QueryBuilder::addReturnFunctionValue( int function, int table, int value)
{
    if ( !m_values.isEmpty() && m_values != "DISTINCT " ) m_values += ",";
    m_values += functionName( function ) + "(";
    m_values += tableName( table ) + ".";
    m_values += valueName( value )+ ")";
    m_values += " AS ";
    m_values += functionName( function )+tableName( table )+valueName( value );

    m_linkTables |= table;
    m_returnValues++;
}
예제 #4
0
void
QueryBuilder::sortByFunction( int function, int table, int value, bool descending )
{
    // This function should be used with the equivalent addReturnFunctionValue (with the same function on same values)
    // since it uses the "func(table.value) AS functablevalue" definition.

    //shall we sort case-sensitively? (not for integer columns!)
    bool b = true;
    if ( value & valID || value & valTrack || value & valScore || value & valLength || value & valBitrate ||
         value & valSamplerate || value & valPlayCounter || value & valAccessDate || value & valCreateDate || value & valPercentage ||
         table & tabYear )
        b = false;

    if ( !m_sort.isEmpty() ) m_sort += ",";
    //m_sort += functionName( function ) + "(";
    if ( b ) m_sort += "LOWER( ";
    if ( table & tabYear ) m_sort += "(";

    QString columnName = functionName( function )+tableName( table )+valueName( value );
    m_sort += columnName;

    if ( table & tabYear ) m_sort += "+0)";
    if ( b ) m_sort += " ) ";
    //m_sort += " ) ";
    if ( descending ) m_sort += " DESC ";

    m_linkTables |= table;
}
예제 #5
0
pwan::p_returnValue pwan::t_cmdlineParser::set(const std::string &name, const std::string &value)
{
    std::string functionName("set");
    dprint(className + "::" + functionName, name + " = " + value, 3);
    internalData[name] = value;
    return P_OK;
}
예제 #6
0
VisitResult EvaluatorVisitor::Visit(FunctionNode* node)
{
  std::string functionName(node->mName.mText, node->mName.mLength);
  auto& currentSymbols = symbol_stack_.back();
  Function* functionSymbol;
  if(currentSymbols.find(functionName) == currentSymbols.end())
  {
    functionSymbol = library_->CreateFunction(functionName, !parent_type_);
  }
  else
  {
    ErrorSameName(functionName);
  }
  node->mSymbol = functionSymbol;
  functionSymbol->mType = node->mSignatureType;
  if(parent_type_)
  {
    node->mSymbol->mParentType = parent_type_;
    parent_type_->mMembers.push_back(node->mSymbol);
    parent_type_->mMembersByName.insert(std::make_pair(node->mSymbol->mName, node->mSymbol));

  }
  //
  symbol_stack_.back().insert(std::make_pair(functionSymbol->mName, functionSymbol));
  auto storeParent = parent_function_;
  parent_function_ = node->mSymbol;
  symbol_stack_.push_back(std::unordered_map<std::string, Symbol*>());
  node->Walk(this, false);

  symbol_stack_.pop_back();

  parent_function_ = storeParent;
  return VisitResult::Stop;
}
예제 #7
0
파일: llerror.cpp 프로젝트: Boy/netbook
	bool Log::shouldLog(CallSite& site)
	{
		LogLock lock;
		if (!lock.ok())
		{
			return false;
		}
		
		Globals& g = Globals::get();
		Settings& s = Settings::get();
		
		s.shouldLogCallCounter += 1;
		
		std::string class_name = className(site.mClassInfo);
		std::string function_name = functionName(site.mFunction);
		if (site.mClassInfo != typeid(NoClassInfo))
		{
			function_name = class_name + "::" + function_name;
		}

		ELevel compareLevel = s.defaultLevel;

		checkLevelMap(s.functionLevelMap, function_name, compareLevel)
		|| checkLevelMap(s.classLevelMap, class_name, compareLevel)
		|| checkLevelMap(s.fileLevelMap, abbreviateFile(site.mFile), compareLevel);

		site.mCached = true;
		g.addCallSite(site);
		return site.mShouldLog = site.mLevel >= compareLevel;
	}
// two instances of python processing processes should work
TEST_F(SignalProcessingInterfaceTest, TwoInstanceTest) {
    SignalProcessingImpl* sp2 = new SignalProcessingImpl();
    ASSERT_TRUE(sp2 != NULL);
    ASSERT_TRUE(sp2->init(SignalProcessingImpl::MAIN_PROCESSING_SCRIPT));

    android::String8 functionName("intsum");
    int nInputs = 2;
    int nOutputs = 1;
    bool inputTypes[2] = { false, false };
    bool outputTypes[1] = { false };

    TaskCase::Value in0((int64_t)10);
    TaskCase::Value in1((int64_t)100);
    void* inputs[2] = { &in0, &in1 };

    TaskCase::Value out0((int64_t)0);
    void *outputs[1] = { &out0 };

    ASSERT_TRUE(mSp->run( functionName,
            nInputs, inputTypes, inputs,
            nOutputs, outputTypes, outputs) == TaskGeneric::EResultOK);
    ASSERT_TRUE(out0.getInt64() == (in0.getInt64() + in1.getInt64()));
    out0.setInt64(0);
    ASSERT_TRUE(sp2->run( functionName,
                nInputs, inputTypes, inputs,
                nOutputs, outputTypes, outputs) == TaskGeneric::EResultOK);
    ASSERT_TRUE(out0.getInt64() == (in0.getInt64() + in1.getInt64()));
    delete sp2;
}
예제 #9
0
    WhistelDetector(boost::shared_ptr<AL::ALBroker> broker, const std::string &name): AL::ALModule(broker, name), mWhistelCount(0) {
        setModuleDescription("Whistle Detector");

        functionName("setPaused", getName(), "pause / unpause whistel detection");
        addParam("paused", "bool for paused");
        BIND_METHOD(WhistelDetector::setPaused);
    }
예제 #10
0
	bool Log::shouldLog(CallSite& site)
	{
		LogLock lock;
		if (!lock.ok())
		{
			return false;
		}
		
		AIAccess<Settings> settings_w(Settings::get());
		
		settings_w->shouldLogCallCounter += 1;
		
		std::string class_name = className(site.mClassInfo);
		std::string function_name = functionName(site.mFunction);
		if (site.mClassInfo != typeid(NoClassInfo))
		{
			function_name = class_name + "::" + function_name;
		}

		ELevel compareLevel = settings_w->defaultLevel;

		// The most specific match found will be used as the log level,
		// since the computation short circuits.
		// So, in increasing order of importance:
		// Default < Broad Tag < File < Class < Function < Narrow Tag
		((site.mNarrowTag != NULL) ? checkLevelMap(settings_w->tagLevelMap, site.mNarrowTag, compareLevel) : false)
		|| checkLevelMap(settings_w->functionLevelMap, function_name, compareLevel)
		|| checkLevelMap(settings_w->classLevelMap, class_name, compareLevel)
		|| checkLevelMap(settings_w->fileLevelMap, abbreviateFile(site.mFile), compareLevel)
		|| ((site.mBroadTag != NULL) ? checkLevelMap(settings_w->tagLevelMap, site.mBroadTag, compareLevel) : false);

		site.mCached = true;
		AIAccess<Globals>(Globals::get())->addCallSite(site);
		return site.mShouldLog = site.mLevel >= compareLevel;
	}
예제 #11
0
JsonObj OnePeakSettings::toJson() const
{
    QJsonObject ret;
    ret.insert("range", range_.toJson() );
    ret.insert("type", functionName());
    return ret;
}
예제 #12
0
void StackIterator::Frame::print(int indentLevel)
{
    int i = indentLevel;

    if (!this->callFrame()) {
        printif(i, "frame 0x0\n");
        return;
    }

    CodeBlock* codeBlock = this->codeBlock();
    printif(i, "frame %p {\n", this->callFrame());

    CallFrame* callFrame = m_callFrame;
    CallFrame* callerFrame = this->callerFrame();
    void* returnPC = callFrame->hasReturnPC() ? callFrame->returnPC().value() : 0;

    printif(i, "   name '%s'\n", functionName().utf8().data());
    printif(i, "   sourceURL '%s'\n", sourceURL().utf8().data());
    printif(i, "   hostFlag %d\n", callerFrame->hasHostCallFrameFlag());

#if ENABLE(DFG_JIT)
    printif(i, "   isInlinedFrame %d\n", isInlinedFrame());
    if (isInlinedFrame())
        printif(i, "   InlineCallFrame %p\n", m_inlineCallFrame);
#endif

    printif(i, "   callee %p\n", callee());
    printif(i, "   returnPC %p\n", returnPC);
    printif(i, "   callerFrame %p\n", callerFrame->removeHostCallFrameFlag());
    unsigned locationRawBits = callFrame->locationAsRawBits();
    printif(i, "   rawLocationBits %u 0x%x\n", locationRawBits, locationRawBits);
    printif(i, "   codeBlock %p\n", codeBlock);
    if (codeBlock) {
        JITCode::JITType jitType = codeBlock->jitType();
        if (callFrame->hasLocationAsBytecodeOffset()) {
            unsigned bytecodeOffset = callFrame->locationAsBytecodeOffset();
            printif(i, "      bytecodeOffset %u %p / %zu\n", bytecodeOffset, reinterpret_cast<void*>(bytecodeOffset), codeBlock->instructions().size());
#if ENABLE(DFG_JIT)
        } else {
            unsigned codeOriginIndex = callFrame->locationAsCodeOriginIndex();
            printif(i, "      codeOriginIdex %u %p / %zu\n", codeOriginIndex, reinterpret_cast<void*>(codeOriginIndex), codeBlock->codeOrigins().size());
#endif
        }
        unsigned line = 0;
        unsigned column = 0;
        computeLineAndColumn(line, column);
        printif(i, "      line %d\n", line);
        printif(i, "      column %d\n", column);
        printif(i, "      jitType %d <%s> isOptimizingJIT %d\n", jitType, jitTypeName(jitType), JITCode::isOptimizingJIT(jitType));
#if ENABLE(DFG_JIT)
        printif(i, "      hasCodeOrigins %d\n", codeBlock->hasCodeOrigins());
        if (codeBlock->hasCodeOrigins()) {
            JITCode* jitCode = codeBlock->jitCode().get();
            printif(i, "         jitCode %p start %p end %p\n", jitCode, jitCode->start(), jitCode->end());
        }
#endif
    }
    printif(i, "}\n");
}
예제 #13
0
 void SDLError::outputFormattedMessage(std::ostream& os)noexcept{
   os << what()
      << " : " << sdlErrorMessage() << "\n"
      << " at " << functionName()
      << " in " << fileName()
      << " line " << lineNumber()
      << std::endl;
 }
void t_hswidgetuninstaller::testWidgetInstallerSender()
{
    HsWidgetInstallerSender sender;
    HsWidgetComponentDescriptor widgetDescriptor;
    QString functionName("widgetUninstalled(QVariantHash)");
    sender.widgetChanged(functionName, widgetDescriptor);
    // nothing to verify
}
예제 #15
0
파일: bumper.cpp 프로젝트: Sebohe/Proyecto
Bumper::Bumper(boost::shared_ptr<AL::ALBroker> broker,const std::string& name): AL::ALModule(broker, name), fCallbackMutex(AL::ALMutex::createALMutex()){

	std::cout<<"Bumper"<<std::endl;
  setModuleDescription("This module presents how to subscribe to a simple event (here RightBumperPressed) and use a callback method.");

  functionName("onRightBumperPressed", getName(), "Method called when the right bumper is pressed. Makes a LED animation.");
  BIND_METHOD(Bumper::onRightBumperPressed)
}
예제 #16
0
ResponseToNameInterface::ResponseToNameInterface(boost::shared_ptr<AL::ALBroker> pBroker, const std::string& pName) :  AL::ALModule(pBroker, pName) {

    setModuleDescription("Interface module, reacting to events generated by the Logger module, calling child by either name or by using special phrases");

    functionName("startTask", getName(), "Function used to start/enable the task");
    addParam("todo", "Tell the module either to start or enable the task");
    BIND_METHOD(ResponseToNameInterface::startTask);

    functionName("onTactilTouched", getName(), "FrontTactilTouched callback, starts the session");
    BIND_METHOD(ResponseToNameInterface::onTactilTouched);

    functionName("callChild", getName(), "CallChild callback, plays the sound");
    BIND_METHOD(ResponseToNameInterface::callChild);

    functionName("endSession", getName(), "EndSession callback, resets the Interface");
    BIND_METHOD(ResponseToNameInterface::endSession);
}
예제 #17
0
void
AutoEntryScript::DocshellEntryMonitor::Entry(JSContext* aCx, JSFunction* aFunction,
                                             JSScript* aScript, JS::Handle<JS::Value> aAsyncStack,
                                             JS::Handle<JSString*> aAsyncCause)
{
  JS::Rooted<JSFunction*> rootedFunction(aCx);
  if (aFunction) {
    rootedFunction = aFunction;
  }
  JS::Rooted<JSScript*> rootedScript(aCx);
  if (aScript) {
    rootedScript = aScript;
  }

  nsCOMPtr<nsPIDOMWindowInner> window =
    do_QueryInterface(xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx)));
  if (!window || !window->GetDocShell() ||
      !window->GetDocShell()->GetRecordProfileTimelineMarkers()) {
    return;
  }

  nsCOMPtr<nsIDocShell> docShellForJSRunToCompletion = window->GetDocShell();
  nsString filename;
  uint32_t lineNumber = 0;

  js::AutoStableStringChars functionName(aCx);
  if (rootedFunction) {
    JS::Rooted<JSString*> displayId(aCx, JS_GetFunctionDisplayId(rootedFunction));
    if (displayId) {
      if (!functionName.initTwoByte(aCx, displayId)) {
        JS_ClearPendingException(aCx);
        return;
      }
    }
  }

  if (!rootedScript) {
    rootedScript = JS_GetFunctionScript(aCx, rootedFunction);
  }
  if (rootedScript) {
    filename = NS_ConvertUTF8toUTF16(JS_GetScriptFilename(rootedScript));
    lineNumber = JS_GetScriptBaseLineNumber(aCx, rootedScript);
  }

  if (!filename.IsEmpty() || functionName.isTwoByte()) {
    const char16_t* functionNameChars = functionName.isTwoByte() ?
      functionName.twoByteChars() : nullptr;

    JS::Rooted<JS::Value> asyncCauseValue(aCx, aAsyncCause ? StringValue(aAsyncCause) :
                                          JS::NullValue());
    docShellForJSRunToCompletion->NotifyJSRunToCompletionStart(mReason,
                                                               functionNameChars,
                                                               filename.BeginReading(),
                                                               lineNumber, aAsyncStack,
                                                               asyncCauseValue);
  }
}
예제 #18
0
    HandVoiceControl(AL::ALBroker::Ptr broker, const std::string& name)
        : AL::ALModule(broker, std::string("HandVoiceControl"))
        , mutex(AL::ALMutex::createALMutex())
    {
        setModuleDescription("Control hand open/close with voice commands.");

        functionName("onWordRecognized", getName(), "Handle voice command notifications.");
        BIND_METHOD(HandVoiceControl::onWordRecognized);
    }
예제 #19
0
/**
 * Constructor for NaoPre object
 * @param broker The parent broker
 * @param name The name of the module
 */
NaoPre::NaoPre(
    boost::shared_ptr<AL::ALBroker> broker,
    const std::string& name): AL::ALModule(broker, name)
{
  setModuleDescription("Preview controller to translate zmp trajectory into com trajectory");

  functionName("update", "NaoPre", "run the preview controller for one step");
  BIND_METHOD(NaoPre::update);

  functionName("reset", "NaoPre", "reset the preview controller");
  BIND_METHOD(NaoPre::reset);

  functionName("setVerbo", getName(), "set verbose level");
  addParam("verbo_d", "desired verbose level");
  BIND_METHOD(NaoPre::setVerbo);

  verbo = 1;

}
// test to run processing/example.py
TEST_F(SignalProcessingInterfaceTest, exampleTest) {
    android::String8 functionName("example");
    int nInputs = 8;
    int nOutputs = 4;
    bool inputTypes[8] = { true, true, true, true, false, false, false, false };
    bool outputTypes[4] = { true, true, false, false };

    android::sp<Buffer> in0(new Buffer(16, 16, true));
    char* data0 = in0->getData();
    for (size_t i = 0; i < in0->getSize(); i++) {
        data0[i] = i;
    }
    android::sp<Buffer> in1(new Buffer(16, 16, true));
    char* data1 = in1->getData();
    for (size_t i = 0; i < in1->getSize(); i++) {
        data1[i] = i;
    }
    android::sp<Buffer> in2(new Buffer(8, 8, false));
    char* data2 = in2->getData();
    for (size_t i = 0; i < in2->getSize(); i++) {
        data2[i] = i;
    }
    android::sp<Buffer> in3(new Buffer(8, 8, false));
    char* data3 = in3->getData();
    for (size_t i = 0; i < in3->getSize(); i++) {
        data3[i] = i;
    }
    TaskCase::Value in4((int64_t)100);
    TaskCase::Value in5((int64_t)100);
    TaskCase::Value in6(1.0f);
    TaskCase::Value in7(1.0f);
    void* inputs[8] = { &in0, &in1, &in2, &in3, &in4, &in5, &in6, &in7 };

    android::sp<Buffer> out0(new Buffer(16, 16, true));
    char* outdata0 = out0->getData();
    for (size_t i = 0; i < out0->getSize(); i++) {
        outdata0[i] = 0xaa;
    }
    android::sp<Buffer> out1(new Buffer(8, 8, false));
    char* outdata1 = out1->getData();
    for (size_t i = 0; i < out1->getSize(); i++) {
        outdata1[i] = 0xbb;
    }
    TaskCase::Value out2((int64_t)1000);
    TaskCase::Value out3(-1.0f);
    void *outputs[4] = { &out0, &out1, &out2, &out3 };

    ASSERT_TRUE(mSp->run( functionName,
            nInputs, inputTypes, inputs,
            nOutputs, outputTypes, outputs) == TaskGeneric::EResultOK);
    ASSERT_TRUE(*(in0.get()) == *(out0.get()));
    ASSERT_TRUE(*(in2.get()) == *(out1.get()));
    ASSERT_TRUE(in4 == out2);
    ASSERT_TRUE(in6 == out3);
}
예제 #21
0
SubscribeGyro::SubscribeGyro(
  boost::shared_ptr<AL::ALBroker> broker,
  const std::string& name): AL::ALModule(broker, name),
    fCallbackMutex(AL::ALMutex::createALMutex())
{
  setModuleDescription("This module presents how to subscribe to a simple event (here RightSubscribeGyroPressed) and use a callback method.");

  //functionName("onRightSubscribeGyroPressed", getName(), "Method called when the right subscribegyro is pressed. Makes a LED animation.");
  functionName("onMoveBackward", getName(), "MoveBackward");
  //BIND_METHOD(SubscribeGyro::onRightSubscribeGyroPressed)
  BIND_METHOD(SubscribeGyro::onMoveBackward)
  functionName("onMoveForward", getName(), "MoveForward");
  BIND_METHOD(SubscribeGyro::onMoveForward)
  functionName("GyroStart", getName(), "StartMovement");
  BIND_METHOD(SubscribeGyro::GyroStart)

//std::fstream file;
file.open("/home/nao/data/gyroswingdata.txt");

}
예제 #22
0
static void windowObjectCleared(WebKitScriptWorld* world, WebKitWebPage* page, WebKitFrame* frame, gpointer)
{
    JSGlobalContextRef jsContext = webkit_frame_get_javascript_context_for_script_world(frame, world);
    g_assert(jsContext);
    JSObjectRef globalObject = JSContextGetGlobalObject(jsContext);
    g_assert(globalObject);

    JSRetainPtr<JSStringRef> functionName(Adopt, JSStringCreateWithUTF8CString("echo"));
    JSObjectRef function = JSObjectMakeFunctionWithCallback(jsContext, functionName.get(), echoCallback);
    JSObjectSetProperty(jsContext, globalObject, functionName.get(), function, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly, 0);
}
void QuickTestResult::startBenchmark(RunMode runMode, const QString &tag)
{
    QBenchmarkTestMethodData::current->result = QBenchmarkResult();
    QBenchmarkTestMethodData::current->resultAccepted = false;
    QBenchmarkGlobalData::current->context.tag = tag;
    QBenchmarkGlobalData::current->context.slotName = functionName();

    Q_D(QuickTestResult);
    delete d->benchmarkIter;
    d->benchmarkIter = new QTest::QBenchmarkIterationController
        (QTest::QBenchmarkIterationController::RunMode(runMode));
}
예제 #24
0
// print the profiled data in a format that matches the tool sample's output.
double ProfileNode::debugPrintSampleStyleRecursively(int indentLevel, FunctionCallHashCount& countedFunctions, const ProfileSubtreeData& data)
{
    dataLogF("    ");

    auto it = data.selfAndTotalTimes.find(this);
    ASSERT(it != data.selfAndTotalTimes.end());
    double nodeTotalTime = it->value.second;

    // Print function names
    const char* name = functionName().utf8().data();
    double sampleCount = nodeTotalTime * 1000;
    if (indentLevel) {
        for (int i = 0; i < indentLevel; ++i)
            dataLogF("  ");

         countedFunctions.add(functionName().impl());

        dataLogF("%.0f %s\n", sampleCount ? sampleCount : 1, name);
    } else
        dataLogF("%s\n", name);

    ++indentLevel;

    // Print children's names and information
    double sumOfChildrensCount = 0.0;
    for (StackIterator currentChild = m_children.begin(); currentChild != m_children.end(); ++currentChild)
        sumOfChildrensCount += (*currentChild)->debugPrintSampleStyleRecursively(indentLevel, countedFunctions, data);

    sumOfChildrensCount *= 1000;    //
    // Print remainder of samples to match sample's output
    if (sumOfChildrensCount < sampleCount) {
        dataLogF("    ");
        while (indentLevel--)
            dataLogF("  ");

        dataLogF("%.0f %s\n", sampleCount - sumOfChildrensCount, functionName().utf8().data());
    }

    return nodeTotalTime;
}
예제 #25
0
// declare constructor
OnFaceDetection::OnFaceDetection(boost::shared_ptr<AL::ALBroker> broker, const std::string& name):
	AL::ALModule(broker, name),
	fMemoryProxy(getParentBroker()),
	fFaces(AL::ALValue()),
	fFaceCount(0),
	fCallbackMutex(AL::ALMutex::createALMutex()) {

		setModuleDescription("Module that detects faces and acts accordingly.");

		functionName("callback", getName(), "");
		BIND_METHOD(OnFaceDetection::callback);

	}
예제 #26
0
void Profiler::functionEntry(qint64 scriptId)
{
    positionDone();
    QScriptContext *ctx = engine()->currentContext();
    QScriptContextInfo info(ctx);
    //qDebug() << "push ->" << scriptId << info.functionName() << info.functionStartLineNumber();
    Function *f = determineCurrentFunction(currentScriptId.isEmpty() ? -1 : currentScriptId.top());
    QString infoFunctionName = info.functionName();
    if (f) {
        Action action;
        action.line = currentLine.top();
        action.callObject = scriptId;
        action.callFunction = functionName(ctx, scriptId);
        action.callFunctionLine = info.functionStartLineNumber();

        Action *a = 0;
        QList<Action>::iterator i = qBinaryFind(f->actions.begin(), f->actions.end(), action);
        if (i != f->actions.end()) {
            a = &f->actions[i - f->actions.begin()];
        } else {
            f->actions.append(action);
            a = &f->actions[f->actions.count() - 1];
        }
        currentFunction.push(a);
    }

    currentLine.push(0);
    currentFunctionLine.push(info.functionStartLineNumber());
    currentScriptId.push(scriptId);
    f = determineCurrentFunction(scriptId);
    if (!f) {
        Function fn;
        fn.startLine = info.functionStartLineNumber();
        fn.functionName = functionName(ctx, scriptId);
        QList<Function>::iterator i = qLowerBound(objects[scriptId].functions.begin(), objects[scriptId].functions.end(), fn);
        objects[scriptId].functions.insert(i, fn);
    }
}
예제 #27
0
@module_name@::@module_name@(boost::shared_ptr<AL::ALBroker> broker,
                   const std::string& name)
  : AL::ALModule(broker, name)
{
  // Describe the module here. This will appear on the webpage
  setModuleDescription("This is automatically generated comment. Please input short description on your own module.");

  /**
   * Define callable methods with their descriptions:
   * This makes the method available to other cpp modules
   * and to python.
   * The name given will be the one visible from outside the module.
   * This method has no parameters or return value to describe
   * functionName(<method_name>, <class_name>, <method_description>);
   * BIND_METHOD(<method_reference>);
   */
  functionName("printHelloWorld", getName(), "Print hello to the world");
  BIND_METHOD(@module_name@::printHelloWorld);

  /**
   * addParam(<attribut_name>, <attribut_descrption>);
   * This enables to document the parameters of the method.
   * It is not compulsory to write this line.
   *
   * setReturn(<return_name>, <return_description>);
   * This enables to document the return of the method.
   * It is not compulsory to write this line.
   */
  functionName("echo", getName(), "Just echo back the argument.");
  setReturn("ALValue", "return argument");
  BIND_METHOD(@module_name@::echo);

  // If you had other methods, you could bind them here...
  /**
   * Bound methods can only take const ref arguments of basic types,
   * or AL::ALValue or return basic types or an AL::ALValue.
   */
}
예제 #28
0
/**
 * Constructor for NaoSim object
 * @param broker The parent broker
 * @param name The name of the module
 */
NaoSim::NaoSim(
    boost::shared_ptr<AL::ALBroker> broker,
    const std::string& name): AL::ALModule(broker, name),fastMotionCommands(boost::shared_ptr<AL::ALMemoryFastAccess>(new AL::ALMemoryFastAccess()))
{

    std::cout << "[NaoSim::NaoSim] initialize the simulation module" << std::endl;

  setModuleDescription("Simulate the Robot Motion by kinematics");

  functionName("reset", "NaoSim", "reset the preview controller");
  BIND_METHOD(NaoSim::reset);

  functionName("setVerbo", getName(), "set verbose level");
  addParam("verbo_d", "desired verbose level");
  BIND_METHOD(NaoSim::setVerbo);

  functionName("ControlSteps", getName(), "run the simulation");
  addParam("num", "number of steps");
  BIND_METHOD(NaoSim::ControlSteps);

  verbo = 9;

}
예제 #29
0
파일: clojure.c 프로젝트: amosbird/ctags
static void makeFunctionTag (vString * const name, const char *dbp, int scope_index)
{
	functionName (name, dbp);
	if (vStringLength (name) > 0 && ClojureKinds[K_FUNCTION].enabled)
	{
		tagEntryInfo e;
		initTagEntry (&e, vStringValue (name), &(ClojureKinds[K_FUNCTION]));
		e.lineNumber = getInputLineNumber ();
		e.filePosition = getInputFilePosition ();

		e.extensionFields.scopeIndex =  scope_index;
		makeTagEntry (&e);
	}
}
예제 #30
0
void BacktraceLineGdb::rate()
{
    LineRating r;

    //for explanations, see the LineRating enum definition
    if (!fileName().isEmpty()) {
        r = Good;
    } else if (!libraryName().isEmpty()) {
        if (functionName() == "??") {
            r = MissingFunction;
        } else {
            r = MissingSourceFile;
        }
    } else {
        if (functionName() == "??") {
            r = MissingEverything;
        } else {
            r = MissingLibrary;
        }
    }

    d->m_rating = r;
}