Cyclostratigraphy of shallow-water carbonates. Theory and Applications