RowCollection<Group,Hash>::RowCollection(boost::shared_ptr<Query> const& query, const string& name, const Attributes& attributes, size_t chunkSize) : _query(query), _attributes(attributes), _chunkSize(chunkSize), _sizeBuffered(0), _mode(RowCollectionModeAppend) { assert(!attributes.empty()); assert(chunkSize >= 2); // Use (CONFIG_MEM_ARRAY_THRESHOLD / 10) as the #bytes the unflushed items may have. _maxSizeBuffered = Config::getInstance()->getOption<size_t>(CONFIG_MEM_ARRAY_THRESHOLD) * MiB / 10; // Push the empty tag Attributes attributesWithET(attributes); attributesWithET.push_back(AttributeDesc(attributes.size(), DEFAULT_EMPTY_TAG_ATTRIBUTE_NAME, TID_BOOL, AttributeDesc::IS_EMPTY_INDICATOR, 0)); // get the schema Dimensions dims(2); dims[0] = DimensionDesc("Row", 0, MAX_COORDINATE, 1, 0); dims[1] = DimensionDesc("Column", 0, MAX_COORDINATE, _chunkSize, 0); ArrayDesc schema(name, attributesWithET, dims); // create a MemArray _theArray = make_shared<MemArray>(schema,query); // get the array iterators _arrayIterators.reserve(attributes.size()); for (size_t t=0; t<attributes.size(); ++t) { _arrayIterators.push_back(_theArray->getIterator(t)); } }
std::list<std::string>* Node::compatibleModules(void) { list<std::string>* result; Variant* dtypesptr; Attributes dtypes; ConfigManager* cm; std::map<std::string, Constant*> constants; std::string ext; result = NULL; if ((cm = ConfigManager::Get()) != NULL) { result = new list<std::string>; constants = cm->constantsByName("mime-type"); if (!constants.empty() && ((dtypesptr = this->dataType()) != NULL)) { dtypes = dtypesptr->value<Attributes >(); if (!dtypes.empty()) this->__compatibleModulesByType(constants, dtypes, result); delete dtypesptr; } ext = this->extension(); if (!ext.empty()) { constants = cm->constantsByName("extension-type"); if (!constants.empty()) this->__compatibleModulesByExtension(constants, ext, result); } } return result; }
Attributes* Node::attributes() { Attributes* attr; std::set<AttributesHandler*>::iterator handler; Variant* vptr = NULL; Attributes nodeAttributes; attr = NULL; if ((attr = new std::map<std::string, Variant*>) != NULL) { if ((vptr = this->dataType()) != NULL) attr->insert(std::pair<std::string, Variant*>(std::string("type"), vptr)); if (this->__fsobj != NULL) { nodeAttributes = this->_attributes(); if (!nodeAttributes.empty()) { if ((vptr = new Variant(nodeAttributes)) != NULL) attr->insert(std::pair<std::string, Variant*>(this->__fsobj->name, vptr)); } } for (handler = this->__attributesHandlers.begin(); handler != this->__attributesHandlers.end(); handler++) { if ((vptr = new Variant((*handler)->attributes(this))) != NULL) attr->insert(std::pair<std::string, Variant*>((*handler)->name(), vptr)); } } return attr; }
/* GRAMMAR OF A TUPLE TYPE tuple-type → (tuple-type-bodyopt) tuple-type-body → tuple-type-element-list...opt tuple-type-element-list → tuple-type-element tuple-type-element,tuple-type-element-list tuple-type-element → attributes opt inout opt type | inout opt element-name type-annotation element-name → identifier */ TupleTypePtr Parser::parseTupleType() { Token token, token2; expect(L"(", token); TupleTypePtr ret = nodeFactory->createTupleType(token.state); Attributes attributes; if(!predicate(L")")) { do { // tuple-type-element → attributes opt inout opt type inoutoptelement-nametype-annotation attributes.clear(); bool inout = false; if(predicate(L"@")) { parseAttributes(attributes); } inout = match(Keyword::Inout); expect_next(token); if(attributes.empty() && token.type == TokenType::Identifier && token.identifier.keyword == Keyword::_ && peek(token2) && token2.type == TokenType::Colon) { //type-annotation → :attributes opt type if(predicate(L"@")) { parseAttributes(attributes); } expect(L":"); TypeNodePtr type = parseType(); type->setAttributes(attributes); ret->add(inout, token.token, type); } else { restore(token); TypeNodePtr type = parseType(); type->setAttributes(attributes); ret->add(inout, L"", type); } }while(match(L",")); if(match(L"...")) { ret->setVariadicParameters(true); } } expect(L")"); return ret; }
ShaderMaterial( std::string vertexShader, std::string fragmentShader, const Uniforms& uniforms, const Attributes& attributes, const Parameters& parameters ) : Material() { setParameters( parameters, DefaultKeys() ); this->vertexShader = std::move(vertexShader); this->fragmentShader = std::move(fragmentShader); if (!attributes.empty()) { this->attributes = attributes; } if (!uniforms.empty()) { this->uniforms = uniforms; } }
/* getter-setter-keyword-block → {getter-keyword-clause setter-keyword-clause opt} getter-setter-keyword-block → {setter-keyword-clause getter-keyword-clause} getter-keyword-clause → attributes opt get setter-keyword-clause → attributes opt set */ std::pair<CodeBlockPtr, CodeBlockPtr> Parser::parseGetterSetterKeywordBlock() { Token token; Attributes attributes; parseAttributes(attributes); CodeBlockPtr getter = NULL; CodeBlockPtr setter = NULL; if(match(Keyword::Get, token)) { getter = nodeFactory->createCodeBlock(token.state); getter->setAttributes(attributes); parseAttributes(attributes); if(match(Keyword::Set, token)) { setter = nodeFactory->createCodeBlock(token.state); setter->setAttributes(attributes); } else if(!attributes.empty())//attributes defined for setter but setter is not found { Token token; expect_next(token); unexpected(token); } } else if(match(Keyword::Set, token)) { setter = nodeFactory->createCodeBlock(token.state); setter->setAttributes(attributes); parseAttributes(attributes); expect(Keyword::Get, token); getter = nodeFactory->createCodeBlock(token.state); getter->setAttributes(attributes); } return std::make_pair(getter, setter); }