Exemple #1
0
    public void erase(const_iterator iterator)
    {
        if (m_indexesFile == null)
        {
            throw new System.Exception("SwappedMap::erase");
        }

        Dictionary <Key, Descriptor> .Enumerator descriptorsIterator = iterator.innerIterator();
//C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops:
        m_indexesFile.seekp(sizeof(ulong) + (sizeof(bool) + sizeof(Key) + sizeof(uint)) * descriptorsIterator.second.index);
        bool valid = false;

//C++ TO C# CONVERTER TODO TASK: There is no equivalent to 'reinterpret_cast' in C#:
        m_indexesFile.write(reinterpret_cast <char>(valid), sizeof(bool));
        if (m_indexesFile == null)
        {
            throw new System.Exception("SwappedMap::erase");
        }

        m_descriptors.Remove(descriptorsIterator);
//C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops:
        var cacheIteratorsIterator = m_cacheIterators.find(descriptorsIterator.first);

//C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops:
        if (cacheIteratorsIterator != m_cacheIterators.end())
        {
//C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops:
            m_items.Remove(descriptorsIterator.first);
//C++ TO C# CONVERTER TODO TASK: There is no direct equivalent to the STL list 'erase' method in C#:
//C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops:
            m_cache.erase(cacheIteratorsIterator.second);
            m_cacheIterators.Remove(cacheIteratorsIterator);
        }
    }
Exemple #2
0
        Camera(Camera* camera, UInt32 alias_num) 
	{
		if (alias_num >= camera.aliases.size())

            ThrowCME("Camera: Internal error, alias number out of range specified.");

        make = camera.make;
		model = camera.aliases[alias_num];
		canonical_make = camera.canonical_make;
		canonical_model = camera.canonical_model;
		canonical_alias = camera.canonical_aliases[alias_num];
		canonical_id = camera.canonical_id;
		mode = camera.mode;
		cfa = camera.cfa;
		supported = camera.supported;
		cropSize = camera.cropSize;
		cropPos = camera.cropPos;
		decoderVersion = camera.decoderVersion;
		for (UInt32 i = 0; i<camera.blackAreas.size(); i++) {
			blackAreas.push_back(camera.blackAreas[i]);
		}
		for (UInt32 i = 0; i<camera.sensorInfo.size(); i++) {
			sensorInfo.push_back(camera.sensorInfo[i]);
		}
map<string, string>::const_iterator mi = camera.hints.begin();
		for (; mi != camera.hints.end(); ++mi) {
			hints.insert(make_pair((* mi).first, (* mi).second));
		}
	}
        public FileMappedVector <T> .iterator insert(const_iterator position, T val)
        {
            Debug.Assert(isOpened());

//C++ TO C# CONVERTER TODO TASK: The following line was determined to contain a copy constructor call - this should be verified and a copy constructor should be created:
//ORIGINAL LINE: return insert(position, &val, &val + 1);
            return(insert(new Common.FileMappedVector.const_iterator(position), val, val + 1));
        }
            public static const_iterator operator --(int UnnamedParameter)
            {
//C++ TO C# CONVERTER TODO TASK: The following line was determined to contain a copy constructor call - this should be verified and a copy constructor should be created:
//ORIGINAL LINE: const_iterator tmp = *this;
                const_iterator tmp = new const_iterator(this);

                --m_index;
                return(tmp);
            }
        public FileMappedVector <T> .iterator erase(const_iterator first, const_iterator last)
        {
            Debug.Assert(isOpened());

            ulong newSize = size() - std::distance(first, last);

            //C++ TO C# CONVERTER TODO TASK: The typedef 'value_type' was defined in multiple preprocessor conditionals and cannot be replaced in-line:
//C++ TO C# CONVERTER TODO TASK: Only lambda expressions having all locals passed by reference can be converted to C#:
//ORIGINAL LINE: atomicUpdate(newSize, capacity(), prefixSize(), suffixSize(), [this, first, last](value_type* target)
            atomicUpdate(new ulong(newSize), capacity(), prefixSize(), suffixSize(), (value_type target) =>
            {
                std::copy(cbegin(), first, target);
                std::copy(last, cend(), target + std::distance(cbegin(), first));
            });

            return(new iterator(this, first.index()));
        }
//C++ TO C# CONVERTER TODO TASK: The original C++ template specifier was replaced with a C# generic specifier, which may not produce the same behavior:
//ORIGINAL LINE: template<class InputIterator>
        public FileMappedVector <T> .iterator insert <InputIterator>(const_iterator position, InputIterator first, InputIterator last)
        {
            Debug.Assert(isOpened());

            ulong newSize     = size() + (ulong)std::distance(first, last);
            ulong newCapacity = new ulong();

            if (newSize > capacity())
            {
//C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created:
//ORIGINAL LINE: newCapacity = nextCapacity();
                newCapacity.CopyFrom(nextCapacity());
                if (newSize > newCapacity)
                {
//C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created:
//ORIGINAL LINE: newCapacity = newSize;
                    newCapacity.CopyFrom(newSize);
                }
            }
            else
            {
//C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created:
//ORIGINAL LINE: newCapacity = capacity();
                newCapacity.CopyFrom(capacity());
            }

            //C++ TO C# CONVERTER TODO TASK: The typedef 'value_type' was defined in multiple preprocessor conditionals and cannot be replaced in-line:
//C++ TO C# CONVERTER TODO TASK: Only lambda expressions having all locals passed by reference can be converted to C#:
//ORIGINAL LINE: atomicUpdate(newSize, newCapacity, prefixSize(), suffixSize(), [this, position, first, last](value_type* target)
            atomicUpdate(new ulong(newSize), new ulong(newCapacity), prefixSize(), suffixSize(), (value_type target) =>
            {
                std::copy(cbegin(), position, target);
                std::copy(first, last, target + position.index());
                std::copy(position, cend(), target + position.index() + std::distance(first, last));
            });

            return(new iterator(this, position.index()));
        }