예제 #1
0
void OrStatement::checkTree(Type* functionType) {

    lhs_->checkTree(functionType);
    rhs_->checkTree(functionType);

    StatementAssert(this,
                    lhs_->type()->type()->Equals(getTypeManager().getType(Boolean))
                    && rhs_->type()->type()->Equals(
                        getTypeManager().getType(Boolean)),
                    std::string("Or on types ") + lhs_->type()->type()->getTypeName()
                    + " and " + rhs_->type()->type()->getTypeName()
                    + " is not possible. And can only be performed on two booleans");
}
예제 #2
0
bool SeqValueIntersectIterator::nextImpl( store::Item_t &result,
                                          PlanState &plan_state ) const {
  XQPCollator *const coll = theSctx->get_default_collator( loc );
  store::Item_t item;
  TypeManager *const tm = getTypeManager();
  long tz;

  SeqValueIntersectIteratorState *state;
  DEFAULT_STACK_INIT( SeqValueIntersectIteratorState, state, plan_state );

  tz = plan_state.theLocalDynCtx->get_implicit_timezone();

  state->set_[0] = new_Item_set( tm, tz, coll, loc );
  state->set_[1] = new_Item_set( tm, tz, coll, loc );

  while ( consumeNext( item, theChildren[0], plan_state ) )
    if ( state->set_[0]->insert( item.getp() ).second )
      item->addReference();

  while ( consumeNext( item, theChildren[1], plan_state ) )
    if ( ztd::contains( *state->set_[0], item.getp() ) &&
         state->set_[1]->insert( item.getp() ).second ) {
      item->addReference();
      result = item;
      STACK_PUSH( true, state );
    }

  delete_Item_set( state->set_[0] );
  delete_Item_set( state->set_[1] );
  STACK_END( state );
}
예제 #3
0
void cacheable_function::computeCacheSettings(XQueryDiagnostics* aDiag)
{
  if (theAreCacheSettingsComputed)
    return;

  if (!theTypeManager)
    theTypeManager = getTypeManager();

  ZORBA_ASSERT(theTypeManager);

  if (!theAnnotationList)
    useDefaultCachingSettings();
  else if (theAnnotationList->contains(AnnotationInternal::zann_cache))
    useLegacyCache(aDiag);
  else if (theAnnotationList->contains(AnnotationInternal::zann_strictlydeterministic))
    useStrictlyDeterministicCache(aDiag);
  else if (theAnnotationList->contains(AnnotationInternal::zann_deterministic))
    theHasCache = false;
  else
    useDefaultCachingSettings();

  theAreCacheSettingsComputed = true;
  theCache.reset(new FunctionCache(
      theModuleSctx,
      theExcludeFromCacheKey,
      theCompareWithDeepEqual,
      theCacheAcrossSnapshots));
}
예제 #4
0
FunctionReference::FunctionReference(std::string fnNamespace, std::string name,
                                     std::vector<TypeReference> fnArgs, SafeFunction func) {
    name_ = name;
    fnNamespace_ = fnNamespace;
    func_ = func;
    fnArgs_ = fnArgs;
    returnType_ = makeTypeReference(getTypeManager().getType(TypeUnresolved));
}
예제 #5
0
 bool ResourceManager::isLoaded(ResourceType type, ResourceId resId) const {
     ResourceTypeManager const* manager = getTypeManager(type);
     if (manager) {
         return manager->isLoaded(resId);
     } else {
         return false;
     }
 }
예제 #6
0
std::vector<Type*> FunctionReference::getTargetArguments() {
    std::vector<Type*> args;

    for (unsigned int i = 0; i < getArgTypes().size(); i++) {
        if (getArgTypes()[i].get() == nullptr) {
            args.push_back(getTypeManager().getType(TypeUnresolved));
        } else {
            args.push_back(getArgTypes()[i]->type());
        }
    }

    return args;
}
예제 #7
0
FunctionReference::FunctionReference(std::string fnNamespace, std::string name,
                                     std::vector<SafeStatement> fnArgs, SafeFunction func) {
    name_ = name;
    fnNamespace_ = fnNamespace;
    func_ = func;

    for (unsigned int i = 0; i < fnArgs.size(); i++) {
        if (fnArgs[i]->type() == nullptr) {
            printf("Error: Creating a function reference with a null arg ref %s\n",
                    fnArgs[i]->generateDebugInformation().c_str());
        }
        fnArgs_.push_back(fnArgs[i]->type());
    }

    returnType_ = makeTypeReference(getTypeManager().getType(TypeUnresolved));
}
예제 #8
0
		boolean CSignalDisplay::initialize()
		{
			//initializes the ebml input
			m_pStreamedMatrixReaderCallBack = createBoxAlgorithmStreamedMatrixInputReaderCallback(*this);
			m_pStreamedMatrixReader=EBML::createReader(*m_pStreamedMatrixReaderCallBack);
			m_pStimulationReaderCallBack = createBoxAlgorithmStimulationInputReaderCallback(*this);
			m_pStimulationReader=EBML::createReader(*m_pStimulationReaderCallBack);

			m_pBufferDatabase = new CBufferDatabase(*this);

			//retrieve settings
			CString l_sTimeScaleSettingValue=FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 0);
			CString l_sDisplayModeSettingValue=FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 1);
			CString l_sManualVerticalScaleSettingValue="false";
			CString l_sVerticalScaleSettingValue="100.";
			if(this->getStaticBoxContext().getSettingCount() > 2) l_sManualVerticalScaleSettingValue=FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 2);
			if(this->getStaticBoxContext().getSettingCount() > 3) l_sVerticalScaleSettingValue=FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 3);

			this->getLogManager() << LogLevel_Debug << "l_sManualVerticalScaleSettingValue=" << l_sManualVerticalScaleSettingValue << "\n";
			this->getLogManager() << LogLevel_Debug << "l_sVerticalScaleSettingValue=" << l_sVerticalScaleSettingValue << "\n";

			//create GUI
			m_pSignalDisplayView = new CSignalDisplayView(
				*m_pBufferDatabase,
				::atof(l_sTimeScaleSettingValue),
				CIdentifier(getTypeManager().getEnumerationEntryValueFromName(OVP_TypeId_SignalDisplayMode, l_sDisplayModeSettingValue)),
				!this->getConfigurationManager().expandAsBoolean(l_sManualVerticalScaleSettingValue),
				::atof(l_sVerticalScaleSettingValue));

			m_pBufferDatabase->setDrawable(m_pSignalDisplayView);

			//parent visualisation box in visualisation tree
			::GtkWidget* l_pWidget=NULL;
			::GtkWidget* l_pToolbarWidget=NULL;
			dynamic_cast<CSignalDisplayView*>(m_pSignalDisplayView)->getWidgets(l_pWidget, l_pToolbarWidget);
			getBoxAlgorithmContext()->getVisualisationContext()->setWidget(l_pWidget);
			if(l_pToolbarWidget != NULL)
			{
				getBoxAlgorithmContext()->getVisualisationContext()->setToolbar(l_pToolbarWidget);
			}

			return true;
		}
예제 #9
0
bool SeqValueUnionIterator::nextImpl( store::Item_t &result,
                                      PlanState &plan_state ) const {
  XQPCollator *const coll = theSctx->get_default_collator( loc );
  store::Item_t item;
  TypeManager *const tm = getTypeManager();
  long tz;

  SeqValueUnionIteratorState *state;
  DEFAULT_STACK_INIT( SeqValueUnionIteratorState, state, plan_state );

  tz = plan_state.theLocalDynCtx->get_implicit_timezone();
  state->set_ = new_Item_set( tm, tz, coll, loc );

  for ( state->child_ = 0; state->child_ < 2; ++state->child_ )
    while ( consumeNext( item, theChildren[ state->child_ ], plan_state ) )
      if ( state->set_->insert( item.getp() ).second ) {
        item->addReference();
        result = item;
        STACK_PUSH( true, state );
      }

  delete_Item_set( state->set_ );
  STACK_END( state );
}
예제 #10
0
TypeReference OrStatement::type() {
    return makeTypeReference(getTypeManager().getType(Boolean));
}
예제 #11
0
 virtual TypeReference type() {
     return makeTypeReference(getTypeManager().getType(Void));
 }
예제 #12
0
		void CSignalDisplay::setStimulation(const uint32 ui32StimulationIndex, const uint64 ui64StimulationIdentifier, const uint64 ui64StimulationDate)
		{
			CString l_oStimulationName = getTypeManager().getEnumerationEntryNameFromValue(OV_TypeId_Stimulation, ui64StimulationIdentifier);
			((CSignalDisplayView*)m_pSignalDisplayView)->onStimulationReceivedCB(ui64StimulationIdentifier, l_oStimulationName);
			m_pBufferDatabase->setStimulation(ui32StimulationIndex, ui64StimulationIdentifier, ui64StimulationDate);
		}
예제 #13
0
		boolean CDisplayCueImage::initialize()
		{
			m_bError=false;

			//>>>> Reading Settings:

			//Number of Cues:
			CString l_sSettingValue;
			m_ui32NuberOfCue = getStaticBoxContext().getSettingCount()/2 -1;

			//Do we display the images in full screen?
			getBoxAlgorithmContext()->getStaticBoxContext()->getSettingValue(0, l_sSettingValue);
			m_bFullScreen=(l_sSettingValue==CString("true")?true:false);

			//Clear screen stimulation:
			getBoxAlgorithmContext()->getStaticBoxContext()->getSettingValue(1, l_sSettingValue);
			m_ui64ClearScreenStimulation=getTypeManager().getEnumerationEntryValueFromName(OV_TypeId_Stimulation, l_sSettingValue);

			//Stimulation ID and images file names for each cue
			m_pImageNames = new CString[m_ui32NuberOfCue];
			m_pStimulationsId = new uint64[m_ui32NuberOfCue];
			for(uint32 i=0; i<m_ui32NuberOfCue; i++)
			{
				getBoxAlgorithmContext()->getStaticBoxContext()->getSettingValue(2*i+2, m_pImageNames[i]);
				getBoxAlgorithmContext()->getStaticBoxContext()->getSettingValue(2*i+3, l_sSettingValue);
				m_pStimulationsId[i]=getTypeManager().getEnumerationEntryValueFromName(OV_TypeId_Stimulation, l_sSettingValue);
			}

			//>>>> Initialisation
			m_oStimulationDecoder.initialize(*this);
			m_oStimulationEncoder.initialize(*this);

			//load the gtk builder interface
			m_pBuilderInterface=gtk_builder_new();
			gtk_builder_add_from_file(m_pBuilderInterface, "../share/openvibe-plugins/simple-visualisation/openvibe-simple-visualisation-DisplayCueImage.ui", NULL);

			if(!m_pBuilderInterface)
			{
				m_bError = true;
				getBoxAlgorithmContext()->getPlayerContext()->getLogManager() << LogLevel_ImportantWarning << "Couldn't load the interface !";
				return false;
			}

			gtk_builder_connect_signals(m_pBuilderInterface, NULL);

			m_pDrawingArea = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "DisplayCueImageDrawingArea"));
			g_signal_connect(G_OBJECT(m_pDrawingArea), "expose_event", G_CALLBACK(DisplayCueImage_RedrawCallback), this);
			g_signal_connect(G_OBJECT(m_pDrawingArea), "size-allocate", G_CALLBACK(DisplayCueImage_SizeAllocateCallback), this);

			//set widget bg color
			gtk_widget_modify_bg(m_pDrawingArea, GTK_STATE_NORMAL, &m_oBackgroundColor);
			gtk_widget_modify_bg(m_pDrawingArea, GTK_STATE_PRELIGHT, &m_oBackgroundColor);
			gtk_widget_modify_bg(m_pDrawingArea, GTK_STATE_ACTIVE, &m_oBackgroundColor);

			gtk_widget_modify_fg(m_pDrawingArea, GTK_STATE_NORMAL, &m_oForegroundColor);
			gtk_widget_modify_fg(m_pDrawingArea, GTK_STATE_PRELIGHT, &m_oForegroundColor);
			gtk_widget_modify_fg(m_pDrawingArea, GTK_STATE_ACTIVE, &m_oForegroundColor);

			//Load the pictures:
			m_pOriginalPicture = new GdkPixbuf*[m_ui32NuberOfCue];
			m_pScaledPicture = new GdkPixbuf*[m_ui32NuberOfCue];

			for(uint32 i=0; i<m_ui32NuberOfCue; i++)
			{
				m_pOriginalPicture[i] = gdk_pixbuf_new_from_file_at_size(m_pImageNames[i], -1, -1, NULL);
				m_pScaledPicture[i]=0;
				if(!m_pOriginalPicture[i])
				{
					getBoxAlgorithmContext()->getPlayerContext()->getLogManager() << LogLevel_Warning << "Error couldn't load ressource file : " << m_pImageNames[i] << "!\n";
					m_bError = true;
					return false;
				}
			}

			getBoxAlgorithmContext()->getVisualisationContext()->setWidget(m_pDrawingArea);

			return true;
		}
예제 #14
0
 void ResourceManager::unload(ResourceType type, ResourceId resId) {
     ResourceTypeManager* manager = getTypeManager(type);
     if (manager) {
         manager->unload(resId);
     }
 }    
예제 #15
0
 ResourceId ResourceManager::define(ResourceType type, boost::shared_ptr<ResourceTemplate> form) {
     return getTypeManager(type)->define(form);
 }