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); }
bool URI::parseURI(const wxString& uri) { wxString::size_type p = uri.find("://"); // find :// if (p == wxString::npos) return false; protocol = uri.substr(0, p); wxString::size_type p2 = uri.find("?", p); // ? if (p2 == wxString::npos) { action = uri.substr(p + 3); params.clear(); return true; } action = uri.substr(p + 3, p2 - p - 3); wxString par = uri.substr(p2 + 1); while (true) { p = par.find("&"); if (p == wxString::npos) { addParam(par); break; } addParam(par.substr(0, p)); par.erase(0, p + 1); } return true; }
void YahooClient::sendFile(FileMessage *msg, FileMessage::Iterator &it, YahooUserData *data) { const QString *name = ++it; if (name == NULL) return; QString m = msg->getPlainText(); addParam(0, getLogin().utf8()); addParam(5, data->Login.ptr); addParam(14, m.local8Bit()); addParam(27, name->local8Bit()); addParam(28, number(it.size()).c_str()); sendPacket(YAHOO_SERVICE_FILETRANSFER); string url; string cookies; url = "http://"; url += getFTServer(); url += ":"; url += number(getFTPort()); url += "/notifyft"; cookies = "Y="; cookies += getCookieY(); cookies += "; T="; cookies += getCookieT(); }
RFunction(const std::string& name, const Param1Type& param1, const Param2Type& param2) : functionSEXP_(R_UnboundValue) { commonInit(name); addParam(param1); addParam(param2); }
void YahooClient::sendTyping(YahooUserData *data, bool bState) { addParam(5, data->Login.ptr); addParam(4, getLogin().utf8()); addParam(14, " "); addParam(13, bState ? "1" : "0"); addParam(49, "TYPING"); sendPacket(YAHOO_SERVICE_NOTIFY, 0x16); }
void YahooClient::addBuddy(YahooUserData *data) { if ((getState() != Connected) || (data->Group.ptr == NULL)) return; addParam(1, getLogin().utf8()); addParam(7, data->Login.ptr); addParam(65, data->Group.ptr ? data->Group.ptr : ""); sendPacket(YAHOO_SERVICE_ADDBUDDY); }
MagicWandFx() : m_tolerance(15.0), m_blurRadius(0.0), m_point(TPointD(0, 0)) { m_contiguous = TBoolParamP(true); m_antialiased = TBoolParamP(true); m_euclideanD = TBoolParamP(true); m_preMolt = TBoolParamP(true); m_isShiftPressed = TBoolParamP(false); m_isAltPressed = TBoolParamP(false); addParam("Tolerance", m_tolerance); addParam("Feather", m_blurRadius); addParam("Point", m_point); addParam("Contiguous", m_contiguous); addParam("Antialias", m_antialiased); addParam("EuclideanD", m_euclideanD); addParam("PreMultiply", m_preMolt); addParam("isShiftPressed", m_isShiftPressed); addParam("isAltPressed", m_isAltPressed); addInputPort("Source", m_input); m_tolerance->setValueRange(0, 255); m_blurRadius->setValueRange(0, 100); }
ALSAWriter::ALSAWriter(Module &module) : snd(NULL), delay(0.0), sample_rate(0), channels(0), autoFindMultichannelDevice(false), err(false) { addParam("delay"); addParam("rate"); addParam("chn"); SetModule(module); }
CXmlNodePtr CrpcBase::rpcFault(CXmlTree& tree, int err, const char *error) { if(!tree.CreateNewTree("fault")) return NULL; CXmlNodePtr fault = tree.GetRoot(); fault->NewNode("value", NULL); fault->NewNode("struct", NULL); addParam(fault,"faultCode",err); addParam(fault,"faultString",error); fault->GetParent(); fault->GetParent(); return fault; }
int testmain() { Object *root = CreateObject("Undefined", "Undefined", 0, CodeBlock, "int"); Object *basetype = CreateObject("BaseType", "BaseType", 0, Type, 0); Object *rect = CreateObject("Rectangle", "BaseType_Rectangle", basetype, Type, 0); Object *rectConst = CreateObject("Rectangle", "Rectangle_Rectangle_Rectangle_int_int", 0, Constructor, "Rectangle"); Object *subexpr = CreateObject(0, 0, 0, Expression, "float"); addCode(subexpr, "3.14159"); addParam(rectConst, "int"); addParam(rectConst, "int"); addSymbol(rectConst, CreateObject("width", "width", 0, Variable, "int")); addSymbol(rectConst, CreateObject("height", "height", 0, Variable, "int")); addSymbol(rectConst, CreateObject("self", "self", 0, Variable, "Rectangle*")); addCode(rectConst, "Rectangle * Rectangle_Rectangle_Rectangle_int_int(int width, int height) {"); addCode(rectConst, " Rectangle * self = (Rectangle*)malloc(sizeof(Rectangle));"); addCode(rectConst, " self->w = width;"); addCode(rectConst, " self->h = height;"); addCode(rectConst, " return self;"); addCode(rectConst, "}"); addSymbol(rect, CreateObject("w", "w", 0, Variable, "int")); addSymbol(rect, CreateObject("h", "h", 0, Variable, "int")); addSymbol(rect, rectConst); addCode(rect, "typedef struct {"); addCode(rect, " BaseType parent;"); addCode(rect, " int w;"); addCode(rect, " int h;"); addCode(rect, "} Rectangle;"); addSymbol(root, basetype); addSymbol(root, rect); addSymbol(root, subexpr); printTree(root, 0); return 0; }
void OcsShareJob::setExpireDate(int shareId, const QDate &date) { appendPath(shareId); setVerb("PUT"); if (date.isValid()) { addParam(QString::fromLatin1("expireDate"), date.toString("yyyy-MM-dd")); } else { addParam(QString::fromLatin1("expireDate"), QString()); } start(); }
bool VAApiWriter::open() { addParam( "Zoom" ); addParam( "AspectRatio" ); addParam( "Deinterlace" ); addParam( "PrepareForHWBobDeint", true ); addParam( "Hue" ); addParam( "Saturation" ); addParam( "Brightness" ); addParam( "Contrast" ); clr(); VADisp = vaGetDisplay( QX11Info::display() ); int minor, major; if ( vaInitialize( VADisp, &minor, &major ) == VA_STATUS_SUCCESS ) { const QString vendor = vaQueryVendorString( VADisp ); isVDPAU = vendor.contains( "VDPAU" ); if ( isVDPAU && !allowVDPAU ) return false; isXvBA = vendor.contains( "XvBA" ); int numProfiles = vaMaxNumProfiles( VADisp ); VAProfile profiles[ numProfiles ]; if ( vaQueryConfigProfiles( VADisp, profiles, &numProfiles ) == VA_STATUS_SUCCESS ) { for ( int i = 0 ; i < numProfiles ; ++i ) profileList.push_back( profiles[ i ] ); return true; } } return false; }
void OcsShareeJob::getSharees(const QString &search, const QString &itemType, int page, int perPage) { setVerb("GET"); addParam(QString::fromLatin1("search"), search); addParam(QString::fromLatin1("itemType"), itemType); addParam(QString::fromLatin1("page"), QString::number(page)); addParam(QString::fromLatin1("perPage"), QString::number(perPage)); start(); }
Echo::Echo() { author = "Caribe"; name = "Echo"; description = "A simple echo effect"; type = Machine::MachineEffect; addParam("time", "Time", "Seconds of echo", Param::ParamFloat, 0.1, 1); addParam("vol", "Volume", "Echo's volume", Param::ParamFloat, 0, 1); cursor = 0; samples = 0; buffer_lx = buffer_rx = 0; }
void OcsShareJob::createShare(const QString& path, const Share::ShareType shareType, const QString& shareWith, const Share::Permissions permissions) { setVerb("POST"); addParam(QString::fromLatin1("path"), path); addParam(QString::fromLatin1("shareType"), QString::number(shareType)); addParam(QString::fromLatin1("shareWith"), shareWith); addParam(QString::fromLatin1("permissions"), QString::number(permissions)); start(); }
// Add a 64-bit binary parameter: void CatApiRequest::addConstInt64Param (const Int64 value) { char asciiValue[24]; Int32 length = sprintf(&asciiValue[0], PF64, value); addParam(&asciiValue[0], length); }
void CatApiRequest::addConstParam (const Lng32 value) { char asciiValue[16]; Int32 length = sprintf( &asciiValue[0], "%d", value ); addParam (&asciiValue[0], length); }
template<> void DbQueryJob<GameServer::DB_StorageBinding>::init(DbConnectionPool* dbConnectionPool) { createBinding(dbConnectionPool, CONFIG_GET()->game.telecaster.connectionString, "select * from item where account_id = ? AND owner_id = 0 AND auction_id = 0 AND keeping_id = 0", DbQueryBinding::EM_MultiRows); addParam("account_id", &InputType::account_id); addColumn("sid", &OutputType::sid); addColumn("account_id", &OutputType::account_id); addColumn("summon_id", &OutputType::summon_id); addColumn("idx", &OutputType::idx); addColumn("code", &OutputType::code); addColumn("cnt", &OutputType::count); addColumn("level", &OutputType::level); addColumn("enhance", &OutputType::enhance); addColumn("ethereal_durability", &OutputType::ethereal_durability); addColumn("endurance", &OutputType::endurance); addColumn("flag", &OutputType::flag); addColumn("gcode", &OutputType::gcode); addColumn("wear_info", &OutputType::wear_info); addColumn("socket_0", &OutputType::socket, 0); addColumn("socket_1", &OutputType::socket, 1); addColumn("socket_2", &OutputType::socket, 2); addColumn("socket_3", &OutputType::socket, 3); addColumn("awaken_sid", &OutputType::awaken_sid); addColumn("remain_time", &OutputType::remain_time); addColumn("elemental_effect_type", &OutputType::elemental_effect_type); addColumn("elemental_effect_expire_time", &OutputType::elemental_effect_expire_time); addColumn("elemental_effect_attack_point", &OutputType::elemental_effect_attack_point); addColumn("elemental_effect_magic_point", &OutputType::elemental_effect_magic_point); addColumn("appearance_code", &OutputType::appearance_code); addColumn("create_time", &OutputType::create_time); addColumn("update_time", &OutputType::update_time); }
void QPythonParamList::contextMenuEvent(QContextMenuEvent* evt) { QMenu menu(this); QAction* addObjItem = menu.addAction(tr("Add Parameter...")); QAction* editObjItem = menu.addAction(tr("Edit Parameter...")); QAction* delObjItem = menu.addAction(tr("Remove Parameter")); if (currentItem() == NULL) delObjItem->setEnabled(false); QAction* sel = menu.exec(evt->globalPos()); if (sel == addObjItem) { QPythonParamDialog dlg(this); if (dlg.exec() == QDialog::Accepted) addParam(dlg.parameter()); } else if (sel == editObjItem) { QPythonParamDialog dlg(this); dlg.init(fParams[indexOfTopLevelItem(currentItem())]); if (dlg.exec() == QDialog::Accepted) { plPythonParameter param = dlg.parameter(); fParams[indexOfTopLevelItem(currentItem())] = param; QStringList list = makeParamItem(param); for (int i=0; i<list.size(); i++) currentItem()->setText(i, list[i]); } } else if (sel == delObjItem) { delParam(indexOfTopLevelItem(currentItem())); } }
bool TParam::addParam(const TParam &n, const std::string &path) { if (path.empty() || path == ".") return addChild(n); if (path[0] == '/') { if (parent) return parent->addParam(n, path); else return addParam(n, path.substr(1)); } if (path == "..") { if (!parent) return false; return parent->addChild(n); } if (path.size() > 2 && path.substr(0,3) == "../") { if (!parent) return false; return parent->addParam(n, path.substr(3)); } std::size_t pos = path.find_first_of('/'); if (pos == std::string::npos) { if (children.count(path) == 0) { // add missing category addChild(TParam(path)); } return children[path]->addParam(n, "."); } std::string cat = path.substr(0, pos); if (children.count(cat) == 0) { // add missing category addChild(TParam(cat)); } return children[cat]->addParam(n, path.substr(pos+1)); }
void OcsShareJob::createLinkShare(const QString &path, const QString &password) { setVerb("POST"); addParam(QString::fromLatin1("path"), path); addParam(QString::fromLatin1("shareType"), QString::number(Share::TypeLink)); if (!password.isEmpty()) { addParam(QString::fromLatin1("password"), password); } addPassStatusCode(403); start(); }
void extractLayerParams(const Message &msg, cv::dnn::LayerParams ¶ms, bool isInternal = false) { const Descriptor *msgDesc = msg.GetDescriptor(); const Reflection *msgRefl = msg.GetReflection(); for (int fieldId = 0; fieldId < msgDesc->field_count(); fieldId++) { const FieldDescriptor *fd = msgDesc->field(fieldId); if (!isInternal && !ends_with_param(fd->name())) continue; const google::protobuf::UnknownFieldSet& unknownFields = msgRefl->GetUnknownFields(msg); bool hasData = fd->is_required() || (fd->is_optional() && msgRefl->HasField(msg, fd)) || (fd->is_repeated() && msgRefl->FieldSize(msg, fd) > 0) || !unknownFields.empty(); if (!hasData) continue; extractCustomParams(unknownFields, params); if (fd->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { if (fd->is_repeated()) //Extract only first item! extractLayerParams(msgRefl->GetRepeatedMessage(msg, fd, 0), params, true); else extractLayerParams(msgRefl->GetMessage(msg, fd), params, true); } else { addParam(msg, fd, params); } } }
void EditParams::setModule(const char* module) { //Set up the tab widget before rendering into it if(catTab!=NULL) delete catTab; catTab = new QTabWidget(this); m_ui->mainLayout->insertWidget(1, catTab); //Change the module name this->module = module; m_ui->lbl_modulename->setText(QString::fromUtf8(ppk_module_display_name(module))); m_ui->lbl_textintro->setText(tr("Edit settings of the \nmodule %0").arg(QString::fromUtf8(ppk_module_display_name(module)))); //Show the available parameters const ppk_proto_param** list=ppk_module_available_parameters(module); if(list) { int i=0; while(list[i]!=NULL && list[i]->group!=NULL) { if(!categories.contains(QString::fromUtf8(list[i]->group->display_name))) addCategory(catTab, list[i]->group); addParam(catTab, categories[QString::fromUtf8(list[i]->group->display_name)], list[i]); i++; } } }
ParameterWidget::ParameterWidget(QWidget *pParent, const char *pName) : QWidget(pParent) { setupUi(this); if(pName) setObjectName(pName); _initialized = false; _shared = false; setSavedFilters(-1); _filterSignalMapper = new QSignalMapper(this); _saveButton->setDisabled(true); _filterGroup->setVisible(false); _filterButton->setChecked(false); connect(_addFilterRow, SIGNAL(clicked()), this, SLOT( addParam() ) ); connect(_filterButton, SIGNAL(clicked()), this, SLOT( setFiltersVisabiltyPreference() ) ); connect(_filterSignalMapper, SIGNAL(mapped(int)), this, SLOT( removeParam(int) )); connect(_saveButton, SIGNAL(clicked()), this, SLOT( save() ) ); connect(_manageButton, SIGNAL(clicked()), this, SLOT( sManageFilters() ) ); connect(_filterList, SIGNAL(currentIndexChanged(int)), this, SLOT( applySaved(int) ) ); connect(_filterList, SIGNAL(currentIndexChanged(int)), this, SLOT( setFiltersDefault() ) ); connect(this, SIGNAL(updated()), this, SLOT( toggleSave() ) ); }
bool RtmApi::authenticate() { addParam("frob", d->frob, true); QString x = call("auth.getToken"); QXmlStreamReader xml(x.toUtf8()); while (!xml.atEnd()) { xml.readNext(); if (xml.name() == "token" && xml.isStartElement()) { xml.readNext(); d->token = xml.text().toString(); } if (xml.name() == "user") { d->userId = xml.attributes().value("id").toString(); d->userName = xml.attributes().value("username").toString(); d->userFullName = xml.attributes().value("fullname").toString(); } } if (!d->token.isEmpty()) { return 0; } else { return 1; } }
void MySqlPreparedStatement::bind( const SqlStmtParameters& holder ) { poco_assert(isPrepared()); poco_assert(_myArgs.size() == _numParams); //finalize adding params if (_myArgs.size() < 1) return; //verify if we bound all needed input parameters if(_numParams != holder.boundParams()) { poco_bugcheck_msg("Not all parameters bound in MySqlPreparedStatement"); return; } size_t nIndex = 0; const SqlStmtParameters::ParameterContainer& holderArgs = holder.params(); for (auto it = holderArgs.begin(); it!=holderArgs.end(); ++it) { //bind parameter addParam(nIndex++, (*it)); } //bind input arguments if(mysql_stmt_bind_param(_myStmt, &_myArgs[0])) poco_bugcheck_msg((string("mysql_stmt_bind_param() failed with ERROR ")+mysql_stmt_error(_myStmt)).c_str()); }
bool OAPIServer::ProcessAddCam(s32 len) { if (len == 0) { return false; } char *pRecv = new char[len + 1]; s32 nRetBody = m_pSocket->Recv((void *)pRecv, len); oapi::OAPIAddCameraReq cam; if (nRetBody == len) { autojsoncxx::ParsingResult result; if (!autojsoncxx::from_json_string(pRecv, cam, result)) { std::cerr << result << '\n'; delete [] pRecv; return false; } } VidCamera addCam; OAPIConverter::Converter(cam.cam, addCam); CameraParam addParam(addCam); m_pFactory.AddCamera(addParam); delete [] pRecv; SendCmnRetRsp(OAPI_CMD_ADD_DEVICE_RSP, true); return TRUE; }
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); }
ConfigTester::ConfigTester() : mySetFunctor(this, &ConfigTester::listAdder), myGetFunctor(this, &ConfigTester::getList) { myInt = 32; myDouble = 239.394; myBool = true; myPose.setPose(42, -42.3, 21.21); strcpy(myString, "happy fun string will begin to smoke"); addParam(ArConfigArg("int", &myInt, "fun things!"), "fuah");//, 0, 300)); addParam(ArConfigArg("double", &myDouble, "fun things double!"));//, 0, 2300)); addParam(ArConfigArg("bool", &myBool, "fun things bool!")); addParam(ArConfigArg("string", myString, "fun things string!", sizeof(myString))); addParam(ArConfigArg("functor", &mySetFunctor, &myGetFunctor, "fun functor thing!")); }
LiveJournalRequest::LiveJournalRequest(LiveJournalClient *client, const char *mode) { m_client = client; m_buffer = new Buffer; addParam("mode", mode); addParam("ver", "1"); if (client->data.owner.User.ptr) addParam("user", client->data.owner.User.ptr); string pass = md5(client->getPassword().utf8()); string hpass; for (unsigned i = 0; i < pass.length(); i++) { char b[5]; sprintf(b, "%02x", pass[i] & 0xFF); hpass += b; } addParam("hpassword", hpass.c_str()); }