//C++ TO C# CONVERTER TODO TASK: C# has no equivalent to ' = delete': // FileMappedVector(const FileMappedVector&) = delete; //C++ TO C# CONVERTER TODO TASK: C# has no equivalent to ' = delete': // FileMappedVector& operator =(const FileMappedVector&) = delete; public void open(string path, FileMappedVectorOpenMode mode = FileMappedVectorOpenMode.OPEN_OR_CREATE, ulong prefixSize = 0) { Debug.Assert(!isOpened()); const ulong initialCapacity = 10; boost::filesystem.path filePath = path; boost::filesystem.path bakPath = path + ".bak"; bool fileExists; if (boost::filesystem.exists(filePath)) { if (boost::filesystem.exists(bakPath)) { boost::filesystem.remove(bakPath); } fileExists = true; } else if (boost::filesystem.exists(bakPath)) { boost::filesystem.rename(bakPath, filePath); fileExists = true; } else { fileExists = false; } if (mode == FileMappedVectorOpenMode.OPEN) { open(path, new ulong(prefixSize)); } else if (mode == FileMappedVectorOpenMode.CREATE) { create(path, new ulong(initialCapacity), new ulong(prefixSize), 0); } else if (mode == FileMappedVectorOpenMode.OPEN_OR_CREATE) { if (fileExists) { open(path, new ulong(prefixSize)); } else { create(path, new ulong(initialCapacity), new ulong(prefixSize), 0); } } else { throw new System.Exception("FileMappedVector: Unsupported open mode: " + Convert.ToString((int)mode)); } }
public FileMappedVector(string path, FileMappedVectorOpenMode mode = FileMappedVectorOpenMode.OPEN_OR_CREATE, ulong prefixSize = 0) { this.m_autoFlush = true; open(path, mode, new ulong(prefixSize)); }