// --------------------------- Cube Section --------------------------- // /// <summary> /// Calculates the number of cubes on this server /// </summary> /// <returns>Number of cubes on this server</returns> public int GetNumberOfCubes() { int viCubeCount = TM1API.TM1ObjectListCountGet(pool.handle, this.handle, TM1API.TM1ServerCubes()); int number = TM1API.TM1ValIndexGet(user.handle, viCubeCount); return(number); }
/// <summary> /// Searches the servers cubes list for the cube with the given name /// </summary> /// <param name="name">Cube name to search for</param> /// <returns>The first found cube with the given name</returns> public Cube GetCubeByName(string name) { Cube cube = this.cubes.Find(x => x.name.Equals(name)); if (cube == null) { int hCube = TM1API.TM1ObjectListHandleByNameGet(this.pool.handle, this.handle, TM1API.TM1ServerCubes(), TM1API.TM1ValString(this.pool.handle, name, 100)); if (TM1API.IsError(user.handle, hCube)) { throw new Cube.NoSuchCubeException(); } cube = new Cube(this.pool, this, hCube); } return(cube); }
/// <summary> /// Iterates over all cubes on this server /// and stores them in the cubes List /// </summary> public void SetCubes() { for (int i = 1; i <= GetNumberOfCubes(); i++) { int hCube = TM1API.TM1ObjectListHandleByIndexGet(this.pool.handle, this.handle, TM1API.TM1ServerCubes(), TM1API.TM1ValIndex(this.pool.handle, i)); if (TM1API.IsError(user.handle, hCube)) { throw new Exception(); } Cube cube = new Cube(this.pool, this, hCube); cubes.Add(cube); } }