示例#1
0
void copyMat (const Mat * pMatA, Mat * pMatB)
{
	Elem * pCurrent;
	double VA;
	int i, j;
	pCurrent = (*pMatA)->HEAD;
	while (pCurrent != NULL)
	{
		i = pCurrent->IA;
		j = pCurrent->JA;
		VA = pCurrent->VA;
		addElement (VA, i, j, pMatB);
		pCurrent = pCurrent->NEXT;
	}
	return;
}
示例#2
0
int MyLIst::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: addElement((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: remove(); break;
        case 2: displayList(); break;
        default: ;
        }
        _id -= 3;
    }
    return _id;
}
int main() {
	Node* list = NULL;
	list = addElement(list, 6);
	list = addElement(list, 6);
	list = addElement(list, 6);
	list = addElement(list, 6);
	list = addElement(list, 6);
	list = addElement(list, 6);
	list = addElement(list, 5);
	showList(list);
	list = removeElements(list, 6);
	showList(list);
	return 0;
}
示例#4
0
Mat addMat (const Mat * pMatA, const Mat * pMatB)
{
	int n, m, iA, iB, jA, jB;
	double value, VA, VB;
	Mat pResult;	//创建结果稀疏矩阵指针
	iA = (*pMatA)->Ni;
	jA = (*pMatA)->Nj;
	iB = (*pMatB)->Ni;
	jB = (*pMatB)->Nj;

	InitMat (&pResult, iA, jB);

	if ( iA == iB && jA == jB )
	{
		for ( n = 1; n <= iA; n++ )
		{
			for ( m = 1, value = 0; m <= jA; m++ )
			{
				/*
				计算C[n m]的value
				C[n m]=A[n m]+B[n m]
				*/
				if ( ((VA = findElemValue (pMatA, n, m)) == 0) &
					((VB = findElemValue (pMatB, n, m)) == 0) )	
					//不要用&&,其具有短路性质,导致另一个表达式没有计算
				{
					value = 0;
				}
				//二者都不为0
				else
				{
					value = VA + VB;	//运算前要记得先对value进行初始化
				}
				if ( value != 0 )
					addElement (value, n, m, &pResult);
				else
					continue;
			}
		}
    	return pResult;
	}
	else
	{
		printf ("addMat: Matrix dimension mismatch!!\n");
		return pResult;	//此处返回的矩阵不含有非0元素,但其指针不为NULL
	}
}
示例#5
0
void ccDBRoot::addEmptyGroup()
{
	//not initialized?
	if (m_contextMenuPos.x()<0 || m_contextMenuPos.y()<0)
		return;

	QModelIndex index = m_dbTreeWidget->indexAt(m_contextMenuPos);
	ccHObject* newGroup = new ccHObject("Group");
	if (index.isValid())
	{
		ccHObject* parent = static_cast<ccHObject*>(index.internalPointer());
		if (parent)
			parent->addChild(newGroup);
	}

	addElement(newGroup);
}
示例#6
0
/* add an instruction at the tail of the list `program->instructions'.
 * Returns an error code. */
void addInstruction(t_program_infos *program, t_axe_instruction *instr)
{
   /* test the preconditions */
   if (program == NULL)
      notifyError(AXE_PROGRAM_NOT_INITIALIZED);
   
   if (instr == NULL)
      notifyError(AXE_INVALID_INSTRUCTION);

   if (program->lmanager == NULL)
      notifyError(AXE_INVALID_LABEL_MANAGER);

   instr->labelID = assign_label(program->lmanager);

   /* update the list of instructions */
   program->instructions = addElement(program->instructions, instr, -1);
}
示例#7
0
void NewElement::addElementVerify(){
    if(newElem->text().isEmpty() || newElem->text().isNull()){
        QMessageBox warning;
        warning.setIcon(QMessageBox::Warning);
        warning.setWindowTitle("Aggiungi elemento");
        warning.setText("Impossibile inserire elementi vuoti.");
        warning.setInformativeText("Riempi l'area di testo o premi il pulsante annulla");
        warning.setStandardButtons(QMessageBox::Ok);
        warning.setDefaultButton(QMessageBox::Ok);
        warning.exec();
    }
    else{
        emit addElement();
        newElem->clear();
        close();
    }
}
示例#8
0
文件: queue.c 项目: MarkMielke/brltty
static Element *
newElement (Queue *queue, void *item) {
  Element *element;

  if (!(element = retrieveElement())) {
    if (!(element = malloc(sizeof(*element)))) {
      logMallocError();
      return NULL;
    }

    element->previous = element->next = NULL;
  }

  addElement(queue, element);
  element->item = item;
  return element;
}
size_t CollisionBoxVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, float maxzoom, float placementZoom) {
    const size_t idx = index();
    void *data = addElement();

    int16_t *shorts = static_cast<int16_t *>(data);
    shorts[0] /* pos */ = x;
    shorts[1] /* pos */ = y;
    shorts[2] /* offset */ = ::round(ox); // use 1/64 pixels for placement
    shorts[3] /* offset */ = ::round(oy);

    uint8_t *ubytes = static_cast<uint8_t *>(data);
    // a_data1
    ubytes[8] = maxzoom * 10;
    ubytes[9] = placementZoom * 10;

    return idx;
}
示例#10
0
t_list * addVariableToSet(t_list *set
               , t_cflow_var *element, int *modified)
{
   /* test the preconditions */
   if (element == NULL)
      return set;

   if (CustomfindElement(set, element
            , compare_CFLOW_Variables) == NULL)
   {
      set = addElement(set, element, -1);
      if (modified != NULL)
         (* modified) = 1;
   }

   /* postconditions */
   return set;
}
示例#11
0
MSBoolean MSHashTable::add(const char *key_, void *value_)
{
  if (size()==0)
   {
     MSMessageLog::errorMessage("MSHashTable: add failed - hash table size==0\n");
     return MSFalse;
   }
  unsigned whichBucket=hash(key_);  
  MSHashEntry *entry=searchBucketFor(bucket(whichBucket),key_);
  if (entry!=0)
   {
     MSMessageLog::errorMessage("MSHashTable: add failed - key already in table: %d\n",key_);
     return MSFalse;
   }
  entry=addElement(key_,whichBucket);
  entry->value(value_);
  return MSTrue;
}
示例#12
0
MSHashEntry *MSNameSpaceHashTable::addSymbol(const char *pSymbol_,MSAtom atomValue_)
{
  if (size()==0)
   {
   MSMessageLog::errorMessage("MSHashTable: add failed - hash table size==0\n");
   return 0;
   }
  unsigned whichBucket=hash(pSymbol_);  
  MSHashEntry *entry=searchBucketFor(bucket(whichBucket),pSymbol_);
  if (entry!=0)
   {
     MSMessageLog::errorMessage("MSHashTable: add failed - key already in table: %s\n",pSymbol_); 
     return 0;
   }
  entry=addElement(pSymbol_,whichBucket);
  entry->value((void *)atomValue_);
  return entry;
}
示例#13
0
//------------------------------------------------------------------------------
//## MultiTechMultiTexture
TEST_F(Test_Shader_Shader, MultiTechMultiTexture)
{
    auto shader1 = Shader::create(LN_ASSETFILE("Shader/MultiTechMultiTexture-1.fx"));

    auto vertexDecl1 = newObject<VertexLayout>();
    vertexDecl1->addElement(0, VertexElementType::Float3, VertexElementUsage::Position, 0);

    Vector3 v[] = {
        { 0, 0.5, 0 },
        { 0.5, -0.25, 0 },
        { -0.5, -0.25, 0 },
    };
    auto vb1 = newObject<VertexBuffer>(sizeof(v), v, GraphicsResourceUsage::Static);

    auto t1 = Texture2D::create(2, 2, TextureFormat::RGBA8);
    t1->clear(Color::Red);
    shader1->findParameter("_Texture1")->setTexture(t1);

    auto t2 = Texture2D::create(2, 2, TextureFormat::RGBA8);
    t2->clear(Color::Green);
    shader1->findParameter("_Texture2")->setTexture(t2);

    auto ctx = Engine::graphicsContext();
    TestEnv::resetGraphicsContext(ctx);
    ctx->setVertexLayout(vertexDecl1);
    ctx->setVertexBuffer(0, vb1);
    ctx->setPrimitiveTopology(PrimitiveTopology::TriangleList);
    ctx->clear(ClearFlags::All, Color::White, 1.0f, 0);

	// _Texture1 のみ (赤)
    ctx->setShaderPass(shader1->techniques()[0]->passes()[0]);
    ctx->drawPrimitive(0, 1);
    ASSERT_SCREEN(LN_ASSETFILE("Shader/Result/Test_Shader_Shader-MultiTechMultiTexture-1.png"));

	// _Texture2 のみ (緑)
    ctx->setShaderPass(shader1->techniques()[1]->passes()[0]);
    ctx->drawPrimitive(0, 1);
    ASSERT_SCREEN(LN_ASSETFILE("Shader/Result/Test_Shader_Shader-MultiTechMultiTexture-2.png"));

	// _Texture1 + _Texture2 (黄)
	ctx->setShaderPass(shader1->techniques()[2]->passes()[0]);
	ctx->drawPrimitive(0, 1);
	ASSERT_SCREEN(LN_ASSETFILE("Shader/Result/Test_Shader_Shader-MultiTechMultiTexture-3.png"));
}
示例#14
0
int XTree::addAttribute(int eid, int lsid, std::string name,
			std::string value,
			unsigned long long valuehash,
			unsigned long long attrhash)
{
	// attribute name first.
	int	aid = addElement(eid, lsid, name);

	// attribute value second.
	addText(aid, NULL_NODE, value, valuehash);

	// hash value third
	int	atopid = aid / _botCap;
	int	abotid = aid % _botCap;
	_isAttribute[atopid][abotid] = true;
	_hashValue[atopid][abotid] = attrhash;

	return aid;
}
示例#15
0
文件: timer.cpp 项目: ukaea/epics
void Timer::run()
{
    TimeStamp currentTime;
    while(true) {
        double period = 0.0;
        TimerCallbackPtr nodeToCall;
        {
            Lock xx(mutex);
            currentTime.getCurrent();
            if (!alive) break;
            TimerCallbackPtr timerCallback = head;
            if(timerCallback.get()!=NULL) {
                double diff = TimeStamp::diff(
                                  timerCallback->timeToRun,currentTime);
                if(diff<=0.0) {
                    nodeToCall = timerCallback;
                    nodeToCall->onList = false;
                    head = head->next;
                    period = timerCallback->period;
                    if(period>0.0) {
                        timerCallback->timeToRun += period;
                        addElement(timerCallback);
                    }
                    timerCallback = head;
                }
            }
        }
        if(nodeToCall.get()!=NULL) {
            nodeToCall->callback();
        }
        {
            Lock xx(mutex);
            if(!alive) break;
        }
        if(head.get()==NULL) {
            waitForWork.wait();
        } else {
            double delay = TimeStamp::diff(head->timeToRun,currentTime);
            waitForWork.wait(delay);
        }
    }
    waitForDone.signal();
}
示例#16
0
std::shared_ptr<ScrollBar> SimpleScrollableAreaSkin::createScrollBar(
    const std::shared_ptr<FloatValue>& controlledValue,
    Direction::Enum direction) const
{
    if (!m_scrollBarEnabled[direction])
        return nullptr;
    auto skin = std::make_shared<CommonScrollBarSkin>(
        createScrollBarBox(direction, m_scrollBarWidth),
        createDragBarBox(direction, m_scrollBarWidth),
        direction);
    skin->setAlwaysShow(false);
    skin->setStep(m_scrollStep);

    auto scrollBarBackground = std::make_shared<StaticFilledRect>(
        std::make_shared<RelativeBox>(RelativeValue(), RelativeValue()));
    scrollBarBackground->setColor(m_backgroundColor);
    skin->addElement(scrollBarBackground);
    
    auto decButtonSkin = std::make_shared<ArrowButtonSkin>(std::make_shared<SquareBox>());
    fillSkin(decButtonSkin.get());
    decButtonSkin->setArrowType(direction == Direction::Horizontal
        ? ArrowButtonSkin::Left : ArrowButtonSkin::Down);
    decButtonSkin->setArrowColor(m_arrowColor);
    decButtonSkin->setArrowPadding(m_arrowPadding);
    skin->setDecButtonSkin(decButtonSkin);

    auto incButtonSkin = std::make_shared<ArrowButtonSkin>(std::make_shared<SquareBox>());
    fillSkin(incButtonSkin.get());
    incButtonSkin->setArrowType(direction == Direction::Horizontal
        ? ArrowButtonSkin::Right : ArrowButtonSkin::Up);
    incButtonSkin->setArrowColor(m_arrowColor);
    incButtonSkin->setArrowPadding(m_arrowPadding);
    skin->setIncButtonSkin(incButtonSkin);

    auto dragBar = std::make_shared<SimpleRectangleButtonSkin>(
        std::make_shared<RelativeBox>(RelativeValue(), RelativeValue()));
    fillSkin(dragBar.get());
    skin->setDragBarSkin(dragBar);

    auto scrollBar = std::make_shared<ScrollBar>(skin, createScrollBarOffset(direction));
    scrollBar->setControlledValue(controlledValue);
    return scrollBar;
}
示例#17
0
STDMETHODIMP JSHook::Invoke(DISPID dispId, REFIID riid, LCID lcid, WORD flags, DISPPARAMS *dispParams, VARIANT *result, EXCEPINFO *exInfo, UINT *argErr) {
	if (dispId == -1)
		return DISP_E_MEMBERNOTFOUND;

	// logElement() takes two arguments, elem and doc.
	//
	if (dispParams->cArgs != 2)
		return DISP_E_BADPARAMCOUNT;

	if (dispParams->rgvarg[0].vt != VT_DISPATCH)
		return DISP_E_BADVARTYPE;

	// Get the document and element, and add the element to the list.
	//
	MSHTML::IHTMLDocument2Ptr doc = dispParams->rgvarg[0].pdispVal;
	MSHTML::IHTMLElementPtr elem = dispParams->rgvarg[1].pdispVal;
	addElement(elem, doc);
	return S_OK;
}
示例#18
0
文件: asm_engine.c 项目: lyudmil/acse
/* Insert an instruction inside the `code' list of `infos' */
int addInstruction(t_translation_infos *infos
      , t_asm_instruction *instruction)
{
   /* preconditions */
   if (infos == NULL)
      return ASM_NOT_INITIALIZED_INFO;
   
   if (instruction == NULL)
      return ASM_UNDEFINED_INSTRUCTION;

   /* update the list of instructions */
   infos->code = addElement(infos->code, instruction, infos->codesize);
   
   /* update the codesize */
   infos->codesize++;

   /* notify that everything went correctly */
   return ASM_OK;
}
示例#19
0
/* alloc a variable identifier */
t_cflow_var * allocVariable (t_cflow_Graph *graph, int identifier)
{
   t_cflow_var * result;
   t_list *elementFound;

   if (graph == NULL)
   {
      cflow_errorcode = CFLOW_GRAPH_UNDEFINED;
      return NULL;
   }

   /* alloc memory for a variable information */
   result = _AXE_ALLOC_FUNCTION(sizeof(t_cflow_var));
   if (result == NULL) {
      cflow_errorcode = CFLOW_OUT_OF_MEMORY;
      return NULL;
   }

   /* update the value of result */
   result->ID = identifier;
   
   /* test if a variable with the same identifier was already present */
   elementFound = CustomfindElement
         (graph->cflow_variables, result, compare_CFLOW_Variables);
   
   if (elementFound == NULL)
   {
      /* update the set of variables */
      graph->cflow_variables = addElement
            (graph->cflow_variables, result, -1);
   }
   else
   {
      _AXE_FREE_FUNCTION(result);
      result = (t_cflow_var *) LDATA(elementFound);
      assert(result != NULL);
      assert(result->ID == identifier);
   }
   
   /* return a new var identifier */
   return result;
}
示例#20
0
int main(int argc, char *argv[])
{
    FILE *fp;
    char buffer[BUFSIZ];
    SET *odd;
    int words;


    /* Check usage and open the file. */

    if (argc != 2) {
        fprintf(stderr, "usage: %s file1\n", argv[0]);
        exit(EXIT_FAILURE);
    }

    if ((fp = fopen(argv[1], "r")) == NULL) {
        fprintf(stderr, "%s: cannot open %s\n", argv[0], argv[1]);
        exit(EXIT_FAILURE);
    }


    /* Insert or delete words to compute their parity. */

words = 0;
    odd = createSet(MAX_SIZE);

    while (fscanf(fp, "%s", buffer) == 1) {
        words ++;

        if (hasElement(odd, buffer))
            removeElement(odd, buffer);
        else
            addElement(odd, buffer);
    }

    printf("%d total words\n", words);
    printf("%d words occur an odd number of times\n", numElements(odd));
    fclose(fp);

    destroySet(odd);
    exit(EXIT_SUCCESS);
}
示例#21
0
void Sphere::load(ofXml * xml)
{
    xml->setTo("elements");
    int n = xml->getNumChildren("element");
    for (int i = 0; i < n; i++)
    {
        xml->setTo("element[" + ofToString(i) + "]");
        
        int started = xml->getValue<float>("started");
        float ballEndX = xml->getValue<float>("ballEndX");
        float ballEndY = xml->getValue<float>("ballEndY");
        float sliderPercent = xml->getValue<float>("sliderPercent");
        ofVec2f ballEnd = ofVec2f(ballEndX, ballEndY);
        addElement(ballEnd, sliderPercent, started);
        xml->setToParent();
    }
    xml->setToParent();

    calcBBox();
}
示例#22
0
template <class TElem> void ValueVectorOf<TElem>::
insertElementAt(const TElem& toInsert, const unsigned int insertAt)
{
    if (insertAt == fCurCount)
    {
        addElement(toInsert);
        return;
    }

    if (insertAt > fCurCount)
        ThrowXML(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex);

    // Make room for the newbie
    for (unsigned int index = fCurCount; index > insertAt; index--)
        fElemList[index] = fElemList[index-1];

    // And stick it in and bump the count
    fElemList[insertAt] = toInsert;
    fCurCount++;
}
示例#23
0
文件: window.cpp 项目: assoc/vector
void Window::mousePressEvent(QMouseEvent *e){
    QPoint qp = e->pos();
    if (e->button() == Qt::LeftButton){
        if (tool.shape == None){tool.ps.clear();}
        tool.ps.append(qp);
        setMouseTracking(true);
        if (((tool.shape == Line || tool.shape == Diamond || tool.shape == Circle) && tool.ps.size() > 1) ||
             (tool.shape == Curve && tool.ps.size() > 2)){
            if (tool.shape == Diamond){
                tool.ps.append(QPoint(2*tool.ps[1].x()-tool.ps[0].x(), tool.ps[0].y()));
                tool.ps.append(QPoint(tool.ps[1].x(), 2*tool.ps[0].y()-tool.ps[1].y()));
            }
            addElement();
        }
        pressed = 1;
    }else if (e->button() == Qt::RightButton){
        tool.ps.append(qp);
        mvpos = qp;
    }
}
示例#24
0
/**
 *  Profire2626 Settings section
 */
Profire2626::Profire2626EAP::SettingsSection::SettingsSection(
        Profire2626::Profire2626EAP* eap, std::string name)
    : Control::Container(eap, name)
    , m_eap(eap)
{
    // Volume Knob
    Control::Container* grp_volumeknob = new Control::Container(m_eap, "VolumeKnob");
    addElement(grp_volumeknob);

    for (unsigned i=0; i<MAUDIO_PROFIRE2626_REGISTER_APP_VOLUME_KNOB_SIZE; ++i) {
        std::stringstream stream;
        stream << "Line" << i*2+1 << "Line" << i*2+2;
        Profire2626EAP::Switch* outputPair =
            new Profire2626EAP::Switch(m_eap, stream.str(),
                                 MAUDIO_PROFIRE2626_REGISTER_APP_VOLUME_KNOB_OFFSET,
                                 MAUDIO_PROFIRE2626_REGISTER_APP_VOLUME_KNOB_VALUE
                                      <<(MAUDIO_PROFIRE2626_REGISTER_APP_VOLUME_KNOB_SHIFT+i));
        grp_volumeknob->addElement(outputPair);
    }
}
示例#25
0
文件: select.cpp 项目: JickLee/Core
UISelect::UISelect() : UISolidLayout(true) {

    label = new UILabel("Select", false, 150.0f);
    addElement(label);

    options_layout = new UISolidLayout(false);
    options_layout->setMargin(3.0f);
    options_layout->parent = this;

    setMargin(vec4(3.0f));
    selected_option = 0;

    open = false;
    selectable = true;

    selectex = texturemanager.grab("ui/select.png", false);
    selectex->bind();
    selectex->setFiltering(GL_NEAREST, GL_NEAREST);
    selectex->setWrapStyle(GL_CLAMP);
}
示例#26
0
/* insert a new node without updating the dataflow informations */
void insertNodeBefore(t_basic_block *block
      , t_cflow_Node *before_node, t_cflow_Node *new_node)
{
   int before_node_posn;
   t_list *before_node_elem;
   
   /* preconditions */
   if (block == NULL)
   {
      cflow_errorcode = CFLOW_INVALID_BBLOCK;
      return;
   }
   
   if (  (new_node == NULL)
         || (new_node->instr == NULL)
         || (before_node == NULL) )
   {
      cflow_errorcode = CFLOW_INVALID_NODE;
      return;
   }

   before_node_elem = findElement(block->nodes, before_node);
   if (before_node_elem == NULL)
   {
      cflow_errorcode = CFLOW_INVALID_NODE;
      return;
   }
   
   if (findElement(block->nodes, new_node) != NULL)
   {
      cflow_errorcode = CFLOW_NODE_ALREADY_INSERTED;
      return;
   }

   /* get the position of the before node */
   before_node_posn = getPosition(block->nodes, before_node_elem);
   assert(before_node_posn != -1);

   /* add the current node to the basic block */
   block->nodes = addElement(block->nodes, new_node, before_node_posn);
}
示例#27
0
文件: bincount.c 项目: kwcai/COEN-12
int main(int argc, char *argv[])
{
    FILE *fp;
    char buffer[MAX_WORD_LENGTH];
    SET *sets[MAX_WORD_LENGTH];
    int i;


    /* Check usage and open the file. */

    if (argc != 2) {
        fprintf(stderr, "usage: %s file1 [file2]\n", argv[0]);
        exit(EXIT_FAILURE);
    }

    if ((fp = fopen(argv[1], "r")) == NULL) {
        fprintf(stderr, "%s: cannot open %s\n", argv[0], argv[1]);
        exit(EXIT_FAILURE);
    }


    /* Insert all words into the set of the appropriate length. */

    for (i = 0; i < MAX_WORD_LENGTH; i ++)
	sets[i] = createSet(MAX_UNIQUE);

    while (fscanf(fp, "%s", buffer) == 1)
        addElement(sets[strlen(buffer) - 1], buffer);

    fclose(fp);


    /* Display the counts for each word length. */

    for (i = 0; i < MAX_DISPLAYED; i ++) {
	printf("%5d distinct words ", numElements(sets[i]));
	printf("of length %d\n", i + 1);
    }

    exit(EXIT_SUCCESS);
}
node_t intersection(node_t list1,node_t list2,node_t intersection_list)
{
        if(list1 == NULL || list2 == NULL)
        {
                intersection_list = NULL;
        }
        else
        {
                node_t temp = list1;
                while(temp != NULL)
                {
                        if(isPresent(list2,temp -> key))
                        {
                                intersection_list = addElement(intersection_list,temp -> key);
                        }
                        temp = temp -> link;
                }
        }

        return intersection_list;
}
示例#29
0
template <class TElem> void ValueVectorOf<TElem>::
insertElementAt(const TElem& toInsert, const XMLSize_t insertAt)
{
    if (insertAt == fCurCount)
    {
        addElement(toInsert);
        return;
    }

    if (insertAt > fCurCount)
        ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager);

    // Make room for the newbie
    ensureExtraCapacity(1);
    for (XMLSize_t index = fCurCount; index > insertAt; index--)
        fElemList[index] = fElemList[index-1];

    // And stick it in and bump the count
    fElemList[insertAt] = toInsert;
    fCurCount++;
}
示例#30
0
void ElementCacheLRU::writeElement(ElementInputStream& inputStream)
{
  boost::shared_ptr<OGRSpatialReference> emptyProjection;

  // Find out if we need to set our projection
  if ( _projection == emptyProjection )
  {
    _projection = inputStream.getProjection();
  }
  else
  {
    // Make sure they haven't shifted projections on us
    if ( inputStream.getProjection()->IsSame(&(*_projection)) == false )
    {
      LOG_ERROR("Tried to change projections in mid-stream");
      return;
    }
  }
  ConstElementPtr newElement = inputStream.readNextElement();
  addElement(newElement);
}