private void open(string path, ulong prefixSize)
        {
//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: m_prefixSize = prefixSize;
            m_prefixSize.CopyFrom(prefixSize);
            m_file.open(path);
            m_path = path;

            if (m_file.size() < prefixSize + metadataSize)
            {
                throw new System.Exception("FileMappedVector::open() file is too small");
            }

            if (size() > capacity())
            {
                throw new System.Exception("FileMappedVector::open() vector size is greater than capacity");
            }

            var minRequiredFileSize = m_prefixSize + metadataSize + vectorDataSize();

            if (m_file.size() < minRequiredFileSize)
            {
                throw new System.Exception("FileMappedVector::open() invalid file size");
            }

//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: m_suffixSize = m_file.size() - minRequiredFileSize;
            m_suffixSize.CopyFrom(m_file.size() - minRequiredFileSize);
        }
Exemple #2
0
 // Copy assignment operator.
 // The behavior is undefined unless 'other' 'StringView' is in defined state, that is 'data' != 'nullptr' || 'size' == 0
 //C++ TO C# CONVERTER NOTE: This 'CopyFrom' method was converted from the original copy assignment operator:
 //ORIGINAL LINE: StringView& operator =(const StringView& other)
 public StringView CopyFrom(StringView other)
 {
     Debug.Assert(other.data != null || other.size == 0);
     data = other.data;
     //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: size = other.size;
     size.CopyFrom(other.size);
     return(this);
 }
//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()));
        }