---
# System prepended metadata

title: Untitled

---

```cpp=

struct IClipFrameObservation {
    // Get all timestamps
    HRESULT GetTimestamps(REFTIME* pTimestamp, size_t* pN);

    // Get single FrameObservation by timestamp
    HRESULT GetFrameObservations(
        REFTIME t,
        FrameObservation* pFObs,
        size_t *pnPerFrameObsCount
    );

};

struct FrameObservation {
    Observation* arrayObs = 0;
    size_t nObs = 0;

    // prevent accidentially shadow copy
    FrameObservation(const FrameObservation&) = delete;
};


struct Observation {
    size_t LKId = -1;
    double feat2D[2];
};


void client(IClipFrameObservation* ico) {
    using REFTIME = unsigned long long;

    // 1. Get all timestamps
    size_t nTime = 0;
    ico->GetTimePoints(0, &nTime);
    std::vector<REFTIME> times (nTime);
    ico->GetTimePoints(&times[0], &nTime);

    std::vector<FrameObservation> frameObsVec (nTime);
    for(size_t i = 0; i < nTime; i++) {
        REFTIME t = times[i];
        FrameObservation& frameObs = frameObsVec[i];

        // 2. Get FrameObservation inner obs count
        ico->GetFrameObservations(t, nullptr, &frameObs.nObs);        
        FObs.arrayObs = new Observation[frameObs.nObs];
        
        // 3. Get FrameObservation
        ico->GetFrameObservations(t, &frameObs, &frameObs.nObs);
    }

    ...

    // 4. Delete FrameObservation
    for(FrameObservation& f: frameObsVec) {
        delete [] f.arrayObs;
    }
}
```
