Exemplo n.º 1
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Record::add(PeakMotion* peakMotion) {
	if ( peakMotion == NULL )
		return false;

	// Element has already a parent
	if ( peakMotion->parent() != NULL ) {
		SEISCOMP_ERROR("Record::add(PeakMotion*) -> element has already a parent");
		return false;
	}

	// Add the element
	_peakMotions.push_back(peakMotion);
	peakMotion->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		peakMotion->accept(&nc);
	}

	// Notify registered observers
	childAdded(peakMotion);
	
	return true;
}
Exemplo n.º 2
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Datalogger::add(Decimation* decimation) {
	if ( decimation == NULL )
		return false;

	// Element has already a parent
	if ( decimation->parent() != NULL ) {
		SEISCOMP_ERROR("Datalogger::add(Decimation*) -> element has already a parent");
		return false;
	}

	// Duplicate index check
	for ( std::vector<DecimationPtr>::iterator it = _decimations.begin(); it != _decimations.end(); ++it ) {
		if ( (*it)->index() == decimation->index() ) {
			SEISCOMP_ERROR("Datalogger::add(Decimation*) -> an element with the same index has been added already");
			return false;
		}
	}

	// Add the element
	_decimations.push_back(decimation);
	decimation->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		decimation->accept(&nc);
	}

	// Notify registered observers
	childAdded(decimation);
	
	return true;
}
Exemplo n.º 3
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Pick::add(Comment* comment) {
	if ( comment == NULL )
		return false;

	// Element has already a parent
	if ( comment->parent() != NULL ) {
		SEISCOMP_ERROR("Pick::add(Comment*) -> element has already a parent");
		return false;
	}

	// Duplicate index check
	for ( std::vector<CommentPtr>::iterator it = _comments.begin(); it != _comments.end(); ++it ) {
		if ( (*it)->index() == comment->index() ) {
			SEISCOMP_ERROR("Pick::add(Comment*) -> an element with the same index has been added already");
			return false;
		}
	}

	// Add the element
	_comments.push_back(comment);
	comment->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		comment->accept(&nc);
	}

	// Notify registered observers
	childAdded(comment);
	
	return true;
}
Exemplo n.º 4
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool SimpleFilter::add(FilterParameter* filterParameter) {
	if ( filterParameter == NULL )
		return false;

	// Element has already a parent
	if ( filterParameter->parent() != NULL ) {
		SEISCOMP_ERROR("SimpleFilter::add(FilterParameter*) -> element has already a parent");
		return false;
	}

	// Add the element
	_filterParameters.push_back(filterParameter);
	filterParameter->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		filterParameter->accept(&nc);
	}

	// Notify registered observers
	childAdded(filterParameter);
	
	return true;
}
Exemplo n.º 5
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool StationGroup::add(StationReference* stationReference) {
    if ( stationReference == NULL )
        return false;

    // Element has already a parent
    if ( stationReference->parent() != NULL ) {
        SEISCOMP_ERROR("StationGroup::add(StationReference*) -> element has already a parent");
        return false;
    }

    // Duplicate index check
    for ( std::vector<StationReferencePtr>::iterator it = _stationReferences.begin(); it != _stationReferences.end(); ++it ) {
        if ( (*it)->index() == stationReference->index() ) {
            SEISCOMP_ERROR("StationGroup::add(StationReference*) -> an element with the same index has been added already");
            return false;
        }
    }

    // Add the element
    _stationReferences.push_back(stationReference);
    stationReference->setParent(this);

    // Create the notifiers
    if ( Notifier::IsEnabled() ) {
        NotifierCreator nc(OP_ADD);
        stationReference->accept(&nc);
    }

    // Notify registered observers
    childAdded(stationReference);

    return true;
}
Exemplo n.º 6
0
void WContainerWidget::insertBefore(WWidget *widget, WWidget *before)
{
  if (before->parent() != this) {
    LOG_ERROR("insertBefore(): 'before' not in this container");
    return;
  }

  if (widget->parent()) {
    if (widget->parent() != this) {
      LOG_WARN("insertWidget(): reparenting widget");
      widget->setParentWidget(0);
    } else
      return;
  }

  int i = Utils::indexOf(*children_, before);
  if (i == -1)
    i = children_->size();

  children_->insert(children_->begin() + i, widget);
  flags_.set(BIT_ADJUST_CHILDREN_ALIGN); // children margins hacks
  repaint(RepaintInnerHtml);

  if (!transientImpl_)
    transientImpl_ = new TransientImpl();
  transientImpl_->addedChildren_.push_back(widget);

  childAdded(widget);
}
Exemplo n.º 7
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool MomentTensor::add(DataUsed* dataUsed) {
	if ( dataUsed == NULL )
		return false;

	// Element has already a parent
	if ( dataUsed->parent() != NULL ) {
		SEISCOMP_ERROR("MomentTensor::add(DataUsed*) -> element has already a parent");
		return false;
	}

	// Add the element
	_dataUseds.push_back(dataUsed);
	dataUsed->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		dataUsed->accept(&nc);
	}

	// Notify registered observers
	childAdded(dataUsed);
	
	return true;
}
Exemplo n.º 8
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool MomentTensor::add(MomentTensorPhaseSetting* momentTensorPhaseSetting) {
	if ( momentTensorPhaseSetting == NULL )
		return false;

	// Element has already a parent
	if ( momentTensorPhaseSetting->parent() != NULL ) {
		SEISCOMP_ERROR("MomentTensor::add(MomentTensorPhaseSetting*) -> element has already a parent");
		return false;
	}

	// Duplicate index check
	for ( std::vector<MomentTensorPhaseSettingPtr>::iterator it = _momentTensorPhaseSettings.begin(); it != _momentTensorPhaseSettings.end(); ++it ) {
		if ( (*it)->index() == momentTensorPhaseSetting->index() ) {
			SEISCOMP_ERROR("MomentTensor::add(MomentTensorPhaseSetting*) -> an element with the same index has been added already");
			return false;
		}
	}

	// Add the element
	_momentTensorPhaseSettings.push_back(momentTensorPhaseSetting);
	momentTensorPhaseSetting->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		momentTensorPhaseSetting->accept(&nc);
	}

	// Notify registered observers
	childAdded(momentTensorPhaseSetting);
	
	return true;
}
Exemplo n.º 9
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool StrongOriginDescription::add(EventRecordReference* eventRecordReference) {
	if ( eventRecordReference == NULL )
		return false;

	// Element has already a parent
	if ( eventRecordReference->parent() != NULL ) {
		SEISCOMP_ERROR("StrongOriginDescription::add(EventRecordReference*) -> element has already a parent");
		return false;
	}

	// Add the element
	_eventRecordReferences.push_back(eventRecordReference);
	eventRecordReference->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		eventRecordReference->accept(&nc);
	}

	// Notify registered observers
	childAdded(eventRecordReference);
	
	return true;
}
Exemplo n.º 10
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool QualityControl::add(Outage* outage) {
	if ( outage == NULL )
		return false;

	// Element has already a parent
	if ( outage->parent() != NULL ) {
		SEISCOMP_ERROR("QualityControl::add(Outage*) -> element has already a parent");
		return false;
	}

	// Duplicate index check
	for ( std::vector<OutagePtr>::iterator it = _outages.begin(); it != _outages.end(); ++it ) {
		if ( (*it)->index() == outage->index() ) {
			SEISCOMP_ERROR("QualityControl::add(Outage*) -> an element with the same index has been added already");
			return false;
		}
	}

	// Add the element
	_outages.push_back(outage);
	outage->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		outage->accept(&nc);
	}

	// Notify registered observers
	childAdded(outage);
	
	return true;
}
Exemplo n.º 11
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool EnvelopeChannel::add(EnvelopeValue* envelopeValue) {
	if ( envelopeValue == NULL )
		return false;

	// Element has already a parent
	if ( envelopeValue->parent() != NULL ) {
		SEISCOMP_ERROR("EnvelopeChannel::add(EnvelopeValue*) -> element has already a parent");
		return false;
	}

	// Add the element
	_envelopeValues.push_back(envelopeValue);
	envelopeValue->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		envelopeValue->accept(&nc);
	}

	// Notify registered observers
	childAdded(envelopeValue);
	
	return true;
}
Exemplo n.º 12
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Record::add(SimpleFilterChainMember* simpleFilterChainMember) {
	if ( simpleFilterChainMember == NULL )
		return false;

	// Element has already a parent
	if ( simpleFilterChainMember->parent() != NULL ) {
		SEISCOMP_ERROR("Record::add(SimpleFilterChainMember*) -> element has already a parent");
		return false;
	}

	// Duplicate index check
	for ( std::vector<SimpleFilterChainMemberPtr>::iterator it = _simpleFilterChainMembers.begin(); it != _simpleFilterChainMembers.end(); ++it ) {
		if ( (*it)->index() == simpleFilterChainMember->index() ) {
			SEISCOMP_ERROR("Record::add(SimpleFilterChainMember*) -> an element with the same index has been added already");
			return false;
		}
	}

	// Add the element
	_simpleFilterChainMembers.push_back(simpleFilterChainMember);
	simpleFilterChainMember->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		simpleFilterChainMember->accept(&nc);
	}

	// Notify registered observers
	childAdded(simpleFilterChainMember);
	
	return true;
}
Exemplo n.º 13
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Route::add(RouteSeedlink* routeSeedlink) {
	if ( routeSeedlink == NULL )
		return false;

	// Element has already a parent
	if ( routeSeedlink->parent() != NULL ) {
		SEISCOMP_ERROR("Route::add(RouteSeedlink*) -> element has already a parent");
		return false;
	}

	// Duplicate index check
	for ( std::vector<RouteSeedlinkPtr>::iterator it = _routeSeedlinks.begin(); it != _routeSeedlinks.end(); ++it ) {
		if ( (*it)->index() == routeSeedlink->index() ) {
			SEISCOMP_ERROR("Route::add(RouteSeedlink*) -> an element with the same index has been added already");
			return false;
		}
	}

	// Add the element
	_routeSeedlinks.push_back(routeSeedlink);
	routeSeedlink->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		routeSeedlink->accept(&nc);
	}

	// Notify registered observers
	childAdded(routeSeedlink);
	
	return true;
}
Exemplo n.º 14
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Origin::add(CompositeTime* compositeTime) {
	if ( compositeTime == NULL )
		return false;

	// Element has already a parent
	if ( compositeTime->parent() != NULL ) {
		SEISCOMP_ERROR("Origin::add(CompositeTime*) -> element has already a parent");
		return false;
	}

	// Add the element
	_compositeTimes.push_back(compositeTime);
	compositeTime->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		compositeTime->accept(&nc);
	}

	// Notify registered observers
	childAdded(compositeTime);
	
	return true;
}
Exemplo n.º 15
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Origin::add(Arrival* arrival) {
	if ( arrival == NULL )
		return false;

	// Element has already a parent
	if ( arrival->parent() != NULL ) {
		SEISCOMP_ERROR("Origin::add(Arrival*) -> element has already a parent");
		return false;
	}

	// Duplicate index check
	for ( std::vector<ArrivalPtr>::iterator it = _arrivals.begin(); it != _arrivals.end(); ++it ) {
		if ( (*it)->index() == arrival->index() ) {
			SEISCOMP_ERROR("Origin::add(Arrival*) -> an element with the same index has been added already");
			return false;
		}
	}

	// Add the element
	_arrivals.push_back(arrival);
	arrival->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		arrival->accept(&nc);
	}

	// Notify registered observers
	childAdded(arrival);
	
	return true;
}
Exemplo n.º 16
0
/*!
    \reimp
    \since 1.1
*/
void QGeoMapGroupObject::setMapData(QGeoMapData *mapData)
{

    for (int i = 0; i < d_ptr->children.size(); ++i) {
        d_ptr->children[i]->setMapData(mapData);
        if (mapData)
            emit childAdded(d_ptr->children[i]);
    }

    QGeoMapObject::setMapData(mapData);
}
Exemplo n.º 17
0
/*!
    Adds \a childObject to the list of children of this map object.

    The children objects are drawn in order of the QGeoMapObject::zValue()
    value.  Children objects having the same z value will be drawn
    in the order they were added.

    The map object will take ownership of \a childObject.
    \since 1.1
*/
void QGeoMapGroupObject::addChildObject(QGeoMapObject *childObject)
{
    if (!childObject || d_ptr->children.contains(childObject))
        return;

    childObject->setMapData(mapData());
    childObject->d_func()->serial = d_func()->serial++;

    //binary search
    QList<QGeoMapObject*>::iterator i = qUpperBound(d_ptr->children.begin(),
                                                    d_ptr->children.end(),
                                                    childObject,
                                                    mapObjectLessThan);
    d_ptr->children.insert(i, childObject);

    connect(childObject, SIGNAL(zValueChanged(int)),
            d_ptr, SLOT(childChangedZValue(int)));

    emit childAdded(childObject);
}
Exemplo n.º 18
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool QualityControl::add(QCLog* qCLog) {
	if ( qCLog == NULL )
		return false;

	// Element has already a parent
	if ( qCLog->parent() != NULL ) {
		SEISCOMP_ERROR("QualityControl::add(QCLog*) -> element has already a parent");
		return false;
	}

	if ( PublicObject::IsRegistrationEnabled() ) {
		QCLog* qCLogCached = QCLog::Find(qCLog->publicID());
		if ( qCLogCached ) {
			if ( qCLogCached->parent() ) {
				if ( qCLogCached->parent() == this )
					SEISCOMP_ERROR("QualityControl::add(QCLog*) -> element with same publicID has been added already");
				else
					SEISCOMP_ERROR("QualityControl::add(QCLog*) -> element with same publicID has been added already to another object");
				return false;
			}
			else
				qCLog = qCLogCached;
		}
	}

	// Add the element
	_qCLogs.push_back(qCLog);
	qCLog->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		qCLog->accept(&nc);
	}

	// Notify registered observers
	childAdded(qCLog);
	
	return true;
}
Exemplo n.º 19
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool MomentTensor::add(MomentTensorStationContribution* momentTensorStationContribution) {
	if ( momentTensorStationContribution == NULL )
		return false;

	// Element has already a parent
	if ( momentTensorStationContribution->parent() != NULL ) {
		SEISCOMP_ERROR("MomentTensor::add(MomentTensorStationContribution*) -> element has already a parent");
		return false;
	}

	if ( PublicObject::IsRegistrationEnabled() ) {
		MomentTensorStationContribution* momentTensorStationContributionCached = MomentTensorStationContribution::Find(momentTensorStationContribution->publicID());
		if ( momentTensorStationContributionCached ) {
			if ( momentTensorStationContributionCached->parent() ) {
				if ( momentTensorStationContributionCached->parent() == this )
					SEISCOMP_ERROR("MomentTensor::add(MomentTensorStationContribution*) -> element with same publicID has been added already");
				else
					SEISCOMP_ERROR("MomentTensor::add(MomentTensorStationContribution*) -> element with same publicID has been added already to another object");
				return false;
			}
			else
				momentTensorStationContribution = momentTensorStationContributionCached;
		}
	}

	// Add the element
	_momentTensorStationContributions.push_back(momentTensorStationContribution);
	momentTensorStationContribution->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		momentTensorStationContribution->accept(&nc);
	}

	// Notify registered observers
	childAdded(momentTensorStationContribution);
	
	return true;
}
Exemplo n.º 20
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool ParameterSet::add(Parameter* parameter) {
	if ( parameter == NULL )
		return false;

	// Element has already a parent
	if ( parameter->parent() != NULL ) {
		SEISCOMP_ERROR("ParameterSet::add(Parameter*) -> element has already a parent");
		return false;
	}

	if ( PublicObject::IsRegistrationEnabled() ) {
		Parameter* parameterCached = Parameter::Find(parameter->publicID());
		if ( parameterCached ) {
			if ( parameterCached->parent() ) {
				if ( parameterCached->parent() == this )
					SEISCOMP_ERROR("ParameterSet::add(Parameter*) -> element with same publicID has been added already");
				else
					SEISCOMP_ERROR("ParameterSet::add(Parameter*) -> element with same publicID has been added already to another object");
				return false;
			}
			else
				parameter = parameterCached;
		}
	}

	// Add the element
	_parameters.push_back(parameter);
	parameter->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		parameter->accept(&nc);
	}

	// Notify registered observers
	childAdded(parameter);
	
	return true;
}
Exemplo n.º 21
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool ArclinkLog::add(ArclinkRequest* arclinkRequest) {
	if ( arclinkRequest == NULL )
		return false;

	// Element has already a parent
	if ( arclinkRequest->parent() != NULL ) {
		SEISCOMP_ERROR("ArclinkLog::add(ArclinkRequest*) -> element has already a parent");
		return false;
	}

	if ( PublicObject::IsRegistrationEnabled() ) {
		ArclinkRequest* arclinkRequestCached = ArclinkRequest::Find(arclinkRequest->publicID());
		if ( arclinkRequestCached ) {
			if ( arclinkRequestCached->parent() ) {
				if ( arclinkRequestCached->parent() == this )
					SEISCOMP_ERROR("ArclinkLog::add(ArclinkRequest*) -> element with same publicID has been added already");
				else
					SEISCOMP_ERROR("ArclinkLog::add(ArclinkRequest*) -> element with same publicID has been added already to another object");
				return false;
			}
			else
				arclinkRequest = arclinkRequestCached;
		}
	}

	// Add the element
	_arclinkRequests.push_back(arclinkRequest);
	arclinkRequest->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		arclinkRequest->accept(&nc);
	}

	// Notify registered observers
	childAdded(arclinkRequest);
	
	return true;
}
Exemplo n.º 22
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool EventParameters::add(Event* event) {
	if ( event == NULL )
		return false;

	// Element has already a parent
	if ( event->parent() != NULL ) {
		SEISCOMP_ERROR("EventParameters::add(Event*) -> element has already a parent");
		return false;
	}

	if ( PublicObject::IsRegistrationEnabled() ) {
		Event* eventCached = Event::Find(event->publicID());
		if ( eventCached ) {
			if ( eventCached->parent() ) {
				if ( eventCached->parent() == this )
					SEISCOMP_ERROR("EventParameters::add(Event*) -> element with same publicID has been added already");
				else
					SEISCOMP_ERROR("EventParameters::add(Event*) -> element with same publicID has been added already to another object");
				return false;
			}
			else
				event = eventCached;
		}
	}

	// Add the element
	_events.push_back(event);
	event->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		event->accept(&nc);
	}

	// Notify registered observers
	childAdded(event);
	
	return true;
}
Exemplo n.º 23
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Routing::add(Route* route) {
	if ( route == NULL )
		return false;

	// Element has already a parent
	if ( route->parent() != NULL ) {
		SEISCOMP_ERROR("Routing::add(Route*) -> element has already a parent");
		return false;
	}

	if ( PublicObject::IsRegistrationEnabled() ) {
		Route* routeCached = Route::Find(route->publicID());
		if ( routeCached ) {
			if ( routeCached->parent() ) {
				if ( routeCached->parent() == this )
					SEISCOMP_ERROR("Routing::add(Route*) -> element with same publicID has been added already");
				else
					SEISCOMP_ERROR("Routing::add(Route*) -> element with same publicID has been added already to another object");
				return false;
			}
			else
				route = routeCached;
		}
	}

	// Add the element
	_routes.push_back(route);
	route->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		route->accept(&nc);
	}

	// Notify registered observers
	childAdded(route);
	
	return true;
}
Exemplo n.º 24
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool StrongMotionParameters::add(StrongOriginDescription* strongOriginDescription) {
	if ( strongOriginDescription == NULL )
		return false;

	// Element has already a parent
	if ( strongOriginDescription->parent() != NULL ) {
		SEISCOMP_ERROR("StrongMotionParameters::add(StrongOriginDescription*) -> element has already a parent");
		return false;
	}

	if ( PublicObject::IsRegistrationEnabled() ) {
		StrongOriginDescription* strongOriginDescriptionCached = StrongOriginDescription::Find(strongOriginDescription->publicID());
		if ( strongOriginDescriptionCached ) {
			if ( strongOriginDescriptionCached->parent() ) {
				if ( strongOriginDescriptionCached->parent() == this )
					SEISCOMP_ERROR("StrongMotionParameters::add(StrongOriginDescription*) -> element with same publicID has been added already");
				else
					SEISCOMP_ERROR("StrongMotionParameters::add(StrongOriginDescription*) -> element with same publicID has been added already to another object");
				return false;
			}
			else
				strongOriginDescription = strongOriginDescriptionCached;
		}
	}

	// Add the element
	_strongOriginDescriptions.push_back(strongOriginDescription);
	strongOriginDescription->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		strongOriginDescription->accept(&nc);
	}

	// Notify registered observers
	childAdded(strongOriginDescription);
	
	return true;
}
Exemplo n.º 25
0
void Item::addChild( Item *child )
{
	if ( !child )
		return;
	
	if ( child->contains(this) )
	{
// 		kError() << k_funcinfo << "Attempting to add a child to this item that is already a parent of this item. Incest results in stack overflow." << endl;
		return;
	}
	
	if ( contains( child, true ) )
	{
// 		kError() << k_funcinfo << "Already have child " << child << endl;
		return;
	}
	
	m_children.append(child);
	connect( child, SIGNAL(removed(Item* )), this, SLOT(removeChild(Item* )) );
	
	child->setParentItem(this);
	childAdded(child);
	p_itemDocument->slotUpdateZOrdering();
}
Exemplo n.º 26
0
void TreentNode::insertChildAt( TreentNodeRef child, size_t index )
{
  child->setParent( this );
  mChildren.insert( mChildren.begin() + index, child );
  childAdded( child );
}